#include <stdio.h>
#include <limits.h>
int main()
{
printf ("char: [%d, %d]\n", CHAR_MIN, CHAR_MAX);
return 0;
}
You get: char: [-128, 127]OK, now I get confused. When you initialize literals, specifically integers in ASCII, ASCII encodes from 0 to 255 all decimal, all positive. This of course is the same quantity of integers as is available in the code above (>= -128, <=127), but without the negative integers.
Consider the two simple lines of (ASCII) code defining two character variables.
char c2 = 197;- is essentially identical to -
char c = '+';as in ASCII, the plus sign is described in base 10 by the integer 197.
How does ASCII resolve what to plop into c2 given: (197 > 127)?
I know I have made a simple question more complicated than it needs to be but I'm sure this question reflects some larger misunderstanding on my part.
This post has been edited by LowWaterMark: 14 August 2008 - 03:04 AM

New Topic/Question
Reply




MultiQuote






|