How to print double quotes in C using printf

How to print double quotes in C:

To print double quotes or ” using printf, we can take help of backslash. Because, directly, we can’t print double quotes in C. If we try to print ” like the below program, it will throw one compile error:

#include <stdio.h>

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

C program to print double quotes :

We can use ” at any place inside printf to print a double quotes. For example:

#include <stdio.h>

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

It will print:

"

Similarly, we can add double quotes inside a string:

#include <stdio.h>

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

It will print:

"Hello World !!"

You might also like: