devxlogo

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.

See also  5 Tips for Choosing the Right Medical Software for Your Practice
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist