Build lines with escapes and multiple calls
Print a repair note
The workshop has finished repairing a radio. Its note needs quotation marks around "ready" and a sample folder path with a backslash. A plain double quote would end the C string; a backslash introduces an escape sequence. Use these spellings to include the intended characters:
| Source spelling | What it writes |
|---|---|
\" | One double quote |
\\ | One backslash |
\n | A newline |
c
#include <stdio.h>
int main(void) {
printf("Radio: ");
printf("\"ready\"\n");
printf("Folder: C:\\repairs\n");
return 0;
}
The first call writes Radio: without ending the line. The second adds "ready" and a newline. The third writes Folder: C:\repairs on the next line. This is only a printed example path; the program does not create or open a folder.
Run it. Three printf calls produce two lines because only two of the strings contain \n. The next exercise uses the same escapes for a different repair note.