Here is a small program which i saw a couple of years ago.
#include<stdio.h>
int main()
{
char x;
if(sizeof(int)==sizeof('a'))
printf("\n C compiler\n");
else
printf("C++ compiler\n");
}
output of program::
when stored as .c prints c compiler.
when stored as .cpp prints c++ compiler.
In c characters are stored as integer, then why does sizeof(char) or sizeof(x) [In above example x is a variable of type char] returns 1 in c, where as sizeof('a') returns 4?