comp.lang.c
[Top] [All Lists]

Re: printf and cout

Subject: Re: printf and cout
From: Mark McIntyre
Date: Wed, 26 Mar 2008 23:22:11 +0000
Newsgroups: comp.lang.c


Richard Heathfield wrote:
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.

Its not printing 63, its just printing "?" to mean "I don't know how to represent a value outside the characterset this screen uses".

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy