Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In C++, a string that exists on multiple lines can be represented using either a string literal or a concatenation of multiple string literals.

Using a string literal:

std::string myString = "This is a string\n"
                       "that exists on multiple lines\n"
                       "using a string literal.";

Using a concatenation of multiple string literals:

std::string myString = "This is a string\n"
                       "that exists on multiple lines"
                       "using a concatenation of "
                       "multiple string literals.";