Another Technique of Marking Line Continuation

Another Technique of Marking Line Continuation

When a long line of a quoted string has to be broken, you can use the line continuation marker as described in the tip Use the Continuation Marker Before a Line Break. However, both C and C++ offer another method of breaking long lines, which relies on the fact that when the compiler sees: “literal 1”“literal 2”, it will automatically concatenate the two strings:

 printf("This is a string "       "that will just get concatenated on to the other one "       "and this one too" ); //the compiler concatenates the three quoted strings into a long string

As opposed to using a backslash to mark line continuation, this technique enables you to indent the strings however you like.


Share the Post: