Check out example codes for "char to int c++". It will help you in understanding the concepts better.

Code Example 1

int x  = '9' - 48;
// x now equals 9 as an integer

Code Example 2

int x = (int)character - 48;

Code Example 3

int x = character - '0'

Code Example 4

#include <sstream>

using namespace std;

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

    double x;
    str >> x;
}

Code Example 5

int x = std::stoi("42")

Learn ReactJs, React Native from akashmittal.com