Printing " (double quote) in C

Koushik Sarkar picture Koushik Sarkar · Aug 20, 2014 · Viewed 40.9k times · Source

I am writing a C code which reads from a file and generates an intermediate .c file. To do so I use fprintf() to print into that intermediate file.

How can I print " ?

Answer

Vlad from Moscow picture Vlad from Moscow · Aug 20, 2014

You can use escape symbol \" For example

puts( "\"This is a sentence in quotes\"" );

or

printf( "Here is a quote %c", '\"' );

or

printf( "Here is a quote %c", '"' );