Convert a char to int

I have a numeric keypad that I can read a keypress as a char variable. I now need to convert it to a number. Any help will be appreciated.

Thanx

byte year;
c = poll_slave(SlaveAddr,1); // read the keypad from slave
Serial.println(c);
year = c;
Serial.println(year);

harrysfrags:
I can read a keypress as a char variable. I now need to convert it to a number.

What is the relationship between the character and the number?

number = char - 48 ? :slight_smile:

Or better, number = char - '0'