L
laikon
Hello, everyone:
this is about overflow in C and C++.
int c = 400;
printf("%c", c);
it print ? on screen, and ascii of '?' is 63.
but
cout << int(char(400));
it print -112 on screen.
so, my question is why comes 63 and -112, what relations between
them,
why printf and cout behavior so differently.
both tests are in VC2005.
thanks a lot.
this is about overflow in C and C++.
int c = 400;
printf("%c", c);
it print ? on screen, and ascii of '?' is 63.
but
cout << int(char(400));
it print -112 on screen.
so, my question is why comes 63 and -112, what relations between
them,
why printf and cout behavior so differently.
both tests are in VC2005.
thanks a lot.