3.13 LINE SPLICING
We are aware that C++ allows us to write programs in an unformatted manner. A program line can contain many expressions or a single expression can be written in many lines. However, it may be noted that if the statement consists of strings, such a string cannot be broken over a line. It gives a compilation error. Does it mean that we cannot have large strings? The answer is no. There is a way described in the language. When the string we are writing cannot be completed in one line, a back slash (\) is inserted as the last character and the string is continued in the next line. In this way, a single string can be written by us and understood by the compiler, which spans many lines. For example:
cout << “this is a ……. very very ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access