Print "(double quote) in C
2 answers
If you just want to print one character "
:
putchar('"');
"
does not need to be escaped in a character constant, since character constants are character-delimited '
, not "
. (You can still avoid this if you want:. '\"'
)
If it is part of some larger chunk of output in a string literal, you need to escape it so that it is not considered a closing "
literal:
puts("These are \"quotation marks\"\n");
or
printf("%s\n", "These are \"quotation marks\"");
+4
source to share