is arduino have syntax to convert from char to number type?

hi sorry for my bad english,
i trying to create number input like calculator,
example =
if i press in keypad button “1”, then i press keypad button “2” then the result is 12(twelve),
then if i press keypad button “3”, the result is 123(one hundred twenty-three),etc

but my problem is converting from char type to int type,
i google it for a hour and found nothing that i looking for,
i found about .atoi and int(), but the result is wrong

this is code if it can help :

#include <Wire.h>
#include <Keypad.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
int led_pin = 13;
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {4, 5, 6, 7}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 9, 10, 11}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

char customKey;
long int Value = 0;
long int TempValue = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin (9600);
  lcd.begin(16, 2);
  lcd.clear();
  lcd.print("LCD");
  lcd.setCursor(1, 1);
  lcd.print("TEST");
}

void loop() {

  // put your main code here, to run repeatedly:
  char customKey = customKeypad.getKey();
  if (customKey) {
    lcd.clear();
    Serial.print(" and button pushed is: ");
    Serial.println(customKey);
    lcd.setCursor(0, 0);
    lcd.print(customKey);
    //TempValue = ConvertCharToInt(customKey); [color=red]<= this is the problem[/color]
    Value = (Value * 10) + TempValue;
    lcd.setCursor(0, 1);
    lcd.print(Value);
    Serial.println(TempValue);
  }
}

can somebody help me with the syntax please!!

Subtract ‘0’ from the character returned by getKey() and you will have the actual digit instead of a character representing it.

UKHeliBob:
Subtract '0' from the character returned by getKey() and you will have the actual digit instead of a character representing it.

thanks for the reply,
but how you subtract?
customKey-0?

You subtract '0' from customKey, not 0. Spot the difference.

'0' is ASCII 48 (decimal)
'7' (for instance) is ASCII 55 (decimal)

So if you do

digit = customKey - '0';

when customKey is '7' (ie 55) the result will be
digit = 55 - 48which gives 7

Try some example on paper and it should become clear

UKHeliBob:
You subtract '0' from customKey, not 0. Spot the difference.

'0' is ASCII 48 (decimal)
'7' (for instance) is ASCII 55 (decimal)

So if you do

digit = customKey - '0';

when customKey is '7' (ie 55) the result will be
digit = 55 - 48which gives 7

Try some example on paper and it should become clear

thank you thank you, it works, ha ha ha ha ha ha

I'm glad it works.

Of course you could subtract 48 instead of '0' if that makes more sense