V
vb
Hi all,
I ran the follwing program on windows-XP(86 architecture) using gcc.
#include <stdio.h>
int main()
{
char ch='a';
printf("%u %u\n",sizeof(ch),sizeof('a'));
return 0;
}
The result was : 1 4
My question is why a character constant gave size 4 while same
character assigned to a char variable gave size 1.
I am guessing that char constant was being treated like an integer-was
it?
I ran the follwing program on windows-XP(86 architecture) using gcc.
#include <stdio.h>
int main()
{
char ch='a';
printf("%u %u\n",sizeof(ch),sizeof('a'));
return 0;
}
The result was : 1 4
My question is why a character constant gave size 4 while same
character assigned to a char variable gave size 1.
I am guessing that char constant was being treated like an integer-was
it?