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

Code Example 1

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

Code Example 2

int x = (int)character - 48;

Learn ReactJs, React Native from akashmittal.com