c++ char to int

C++
int x = std::stoi("42")int x = (int)character - 48;#include <sstream>

using namespace std;

int main()
{
    stringstream str;
    
    str << "1";

    double x;
    str >> x;
}
Source

Also in C++: