char to int in c number code example Example 1: turn a char into an int in c int x = character - '0'; Example 2: char* to int in cpp int x = std::stoi("42")