340 views

1 Answer

Best answer
1 votes
1 votes
It prints one single quote '

That backslash \ inside the two single quotes is an escape character. It lets us put ' (single quote) as a character inside the variable a. If this was not present, how would you create a character variable containing ' (single quote) as its value? If you write char a=' ' ' , then the compiler will think you have used the first two single quotes as a way to mark the beginning and ending of the character and the last ' is simply an error. To avoid that, we use special sequences starting with \ which are called escape sequences. There are many escape sequences which have special meanings. Similarly to put a double quote " inside a string variable, we use the expression                  " \" "       so that the compiler does not mistake the second double quote as end of the string.

ex: ' \' '   :  A single quote      \n :  Newline     \b : backspace      etc etc
selected by

Related questions

1 votes
1 votes
0 answers
1
Akshay Nair asked Jan 29, 2018
439 views
What is the output of the following program?void main(){printf("%d",5%2);printf("%d",-5%2);printf("%d",5%-2);printf("%d",-5%-2);printf("%d",2%5);}A) 1,-1 -1 1 0B)1 -1 1 -...
3 votes
3 votes
2 answers
2
Khushal Kumar asked Jul 10, 2017
1,565 views
#include <stdio.h>#include <string.h>void fun(char *arr){int i;unsigned int n = sizeof(arr);printf("n = %d\n", n);for (i=0; i<n; i++) printf("%c ", arr[i]);}// Driver pro...
2 votes
2 votes
2 answers
3
Khushal Kumar asked Jul 8, 2017
1,366 views
int main(){ int a = 3, b = -8, c = 2; printf("%d", a % b / c); return 0;}
2 votes
2 votes
2 answers
4
Khushal Kumar asked Jul 8, 2017
1,275 views
#include<stdio.h int main(void){ int a = 1, 2, 3; printf("%d", a); return 0;}