+ 2
How to assign the value?
using the value of c assign the value 1 into a char c = '1'; int a; And should be possible for any other value of c to be assigned to a using that method
1 Answer
+ 5
int a = c - '0';
It works because characters are integer like values and their numerical values are the ASCII table (you can Google it if you want but knowing it by heart is not at all mandatory, while it can be useful).
Figures from 0 to 9 are represented by following members so '1' - '0' == 1