|
|
laikon said:
> Hello, everyone:
>
> this is about overflow in C and C++.
The behaviour of a C program on overflow is undefined.
> int c = 400;
> printf("%c", c);
>
> it print ? on screen,
Not necessarily. C doesn't guarantee you a screen, and it says very little
about the character set supplied by your implementation.
> and ascii of '?' is 63.
This is irrelevant, I think. If by some chance you'd seen the character
with code point 144 (which is, of course, *not* an ASCII character), I'd
have been able to explain it in concrete terms. I am a little puzzled by
the 63, actually. Try dumping the character to a file and examining a hex
dump thereof.
> but
> cout << int(char(400));
>
> it print -112 on screen.
You might want to ask that in comp.lang.c++
--
Richard Heathfield <http://www.cpax.org.uk>
Email: - www">http://www. +rjh@
Google users: < www.cpax.org.uk/prg/writings/googly.php">http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
|
|