A nudge in the right direction, consider, the character '1' is represented by the character code for '1' which is not equal to 1. Assuming you are using 8 bit characters of a standard type, look up ASCII coding, and the atoi() function.