Display quotes

Hello,

Please how can display quotes with a C program:

fprintf(f," Hello "World"");

in the file i'd like to have Hello "World"

Thank you so much.

When the compiler sees this, it sees " Hello "World"" as three things - a string " Hello ", the token World and an empty string, "". To get it to recognise the middle quotes as part of the string, as opposed to the end/start of the string, you need to escape them with the \ character (just like you use \n and the compiler recognizes you mean a newline, not the letter 'n'):

fprintf(f," Hello \"World\"");
1 Like