usage of 2 charectors in single qoutes in c
Posted
by
user1632141
on Stack Overflow
See other posts from Stack Overflow
or by user1632141
Published on 2012-08-31T09:34:38Z
Indexed on
2012/08/31
9:38 UTC
Read the original article
Hit count: 219
c
#include<stdio.h>
int main()
{
char ch = 'A';
printf("%d\n",'ag');
printf("%d\n",'a');
printf("%d, %d, %d, %d", sizeof(ch), sizeof('a'), sizeof('Ag'), sizeof(3.14f));
return 0;
}
I used to have many doubts on the output of this question while running on g++ and gcc.
But I have cleared almost all the doubts by referring these links:
I still need to understand one thing about the output of this question.
Can someone please explain the output of printf("%d\n",'ag');
mentioned above in the program. How is it actually stored in the memory?
The output for the program on the Linux/GCC platform is:
24935
97
1, 4, 4, 4
© Stack Overflow or respective owner