Because 57 is the ASCII value for the character '9'
If you want to convert a character value for a number into an int you must subtract the value of the character zero ('0')
char x = 9; //Character '9' = ASCII 57
int b;
b = x - '0'; //That is '9' - '0' = 57 - 48 = 9
Alan
|