How do I convert a char to an int in C and C++?
char
int
C and C++ always promote types to at least int. Furthermore character literals are of type int in C and char in C++.
You can convert a char type simply by assigning to an int.
char c = 'a'; // narrowing on C int a = c;