Long strings can be written in multiple lines by using two double quotes ( “ “ ) to break the string at any point in the middle.
A program that demonstrates this in C is given as follows.
Example
#include <stdio.h> int main() { char *str = "This is the method " "to write long strings " "in multiple lines in C"; puts(str); return 0; }
Output
The output of the above program is as follows.
This is the method to write long strings in multiple lines in C
Now let us understand the above program.
The string str can be written in multiple lines by using two double quotes ( “ “ ) to break the string at any point in the middle. Then the string is displayed using puts. The code snippet that shows this is as follows.
char *str = "This is the method " "to write long strings " "in multiple lines in C"; puts(str);