A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
C has no triple-quote syntax. You cannot embed a raw newline inside a string literal. But you have two mechanisms for spreading a long string across multiple source lines. Adjacent string literals are concatenated at compile time: "Hello " "World" becomes "Hello World". A backslash at the end of a line continues the literal onto the next line, including all leading whitespace. The first method is clean. The second is fragile. Use the first.
#include <stdio.h>int main(void) {const char *msg ="This is a long message that has been ""split across multiple lines using ""adjacent string literal concatenation.\n";printf("%s", msg);const char *sql ="SELECT id, name, email\n""FROM users\n""WHERE active = 1\n""ORDER BY name;\n";printf("\n%s", sql);return 0;}
The compiler merges adjacent string literals during translation phase 6, before compilation proper. There is no runtime cost. The resulting binary contains a single contiguous string. This is the standard technique for long log messages, SQL queries, usage text, and embedded HTML or JSON templates.
#include <stdio.h>int main(void) {const char *bad = "Line one \Line two";printf("%s\n", bad);return 0;}
The backslash continues the literal, but all leading whitespace on the next line becomes part of the string. The four spaces of indentation appear in the output. If you accidentally put a space after the backslash, the continuation breaks and you get a compile error. Adjacent literals do not have either problem. They are the better tool.
Adjacent literal concatenation is one of C's quiet conveniences. It costs nothing, reads well, and avoids the whitespace traps of backslash continuation. Use it for any string longer than your line length limit. Next: returning a string from a function, where ownership and lifetime determine whether your code works or crashes.
Finish the lesson once you have worked through the material. This awards ★ 10 XP.