Explicit conversion:
int i; char c = 'A'; i = (int)c;
Conversion by ascii code calculation:
char c = '3'; int x = c - '0'; 或者 int i = (int)(c - '0');
However, the above method can only convert a single char character.
How to convert string "123" to int?
You can use the following methods to convert using the atoi function:
## C# string to int strcpy(str, "123"); val = atoi(str);