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

Topics You Might Like