I have written a small printf statement which is working different in C and C++:
int i;
printf ("%d %d %d %d %d \n", sizeof(i), sizeof('A'), sizeof(sizeof('A')), sizeof(float), sizeof(3.14));
The output for the above program in c using gcc compiler is 4 4 8 4 8
The output for the above program in c++ using g++ compiler is 4 1 8 4 8
I expected 4 1 4 4 8 in c. But the result is not so.
The third parameter in the printf sizeof(sizeof('A')) is giving 8
Can anyone give me the reasoning for this