Search code examples
cprintfdouble-quotesquote

Printing " (double quote) in C


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 " ?


Solution

  • 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", '"' );