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

Code Example 1

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

Code Example 2

#include <sstream>

using namespace std;

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

    double x;
    str >> x;
}

Code Example 3

int x = (int)character - 48;

Code Example 4

int x = character - '0'

Learn ReactJs, React Native from akashmittal.com