I
C++ / C#

Is there multi-line string notation in C or C++?

Is there multi-line string notation in C or C++? if so, how can it be used?
for example:
"""I love
this
kind of syntactic
sugar""".
I think I saw something similar in some C++ tutorial.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2020-07-04
@amateurCoder

Starting from standard 11 there are

//Петь на мотив Джингл-Беллз:
const std::string song =
R"SONG(Очень много, очень много, очень много строк!
Очень много, очень много, очень много строк!
Очень много, очень много, очень много строк!
Очень много, очень много, очень много строк!)SONG";

In place of SONG, there should be a thing that is definitely not in the text (or emptiness if there is no combination ") in the text) so that the compiler can figure out when the line ends.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question