🚀 Code smarter. Crack exams faster. Free AI-powered learning on Leyaa.ai →

How to print single quotes in c

Using \' escape sequence in printf, we can print the single quotes (' ').




\' - escape sequence

When we place \' escape sequence in printf, it has a special meaning.

printf will print ' (single quote) instead \'.

Example

#include<stdio.h>

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

    return 0;
}

Output

' '

Example

#include<stdio.h>

int main()
{
    printf("\'I am in between single quotes\'");

    return 0;
}

Output

'I am in between single quotes'




Useful Resources

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

🚀 One platform. 90+ coding courses. 200+ exams.

From programming fundamentals to competitive exam prep — learn with intelligence, not just content. Free on Leyaa.

Explore Leyaa.ai Free →