char* to int in cpp

C++
int x = std::stoi("42")int x = (int)character - 48;
Source

Also in C++: