Originally posted by: KraziKid
When you declare a character array, and then convert whatever is inside the array to an integer, it uses the ASCII code. For integer, the ASCII code is 48 above what it actually is. So in the case of single digit integers, just subtract 48 from what you receive when you state int(array[0]) and you should receive the correct answer.
ex:
//
char array[10] = "012345678";
cout << hex << int(array[0]) - 48 << dec << " " << int(array[0]) - 48);
//
hope this helps.
