How to print double quotes in c

Using \" escape sequence in printf, we can print the double quotes ("").




\" - escape sequence

Since printf uses ""(double quotes) to identify starting and ending point of a message, we need to use \" escape sequence to print the double quotes.

Example

#include<stdio.h>

int main()
{
    printf("\"\"");

    return 0;
}

Output

""




print Hello World with in double quotes

#include<stdio.h>

int main()
{
    printf("\"Hello World\"");

    return 0;
}

Output

"Hello World"




Useful Resources

https://www.log2base2.com/C/basic/escape-sequence-in-c.html

Topics You Might Like