Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: C++
Expertise: All
Jul 30, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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"<whitespace>"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.

Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date