Incompatibilities between ISO C and ISO C++
A common example is sizeof('A')
, which is usually 4 in C but always 1 in C++, because character constants like 'A'
have the type int
in C but the type char
in C++:
#include
int main(void)
{
printf("%d\n", sizeof('A'));
}