What you are actually getting is the ASCII code for these characters because they are stored in memory as integers known as ASCII
codes.
To convert a char variable to its decimal value instead you can use this:
int value = c - '0';
What this does is that it takes the integer value of c
which is 48 for the '0' for example and subtracts the integer value of '0' from it which is also 48, resulting in 0.
Below is the full table for decimal digits and their corresponding ASCII values:
0 -> 48
1 -> 49
2 -> 50
3 -> 51
4 -> 52
5 -> 53
6 -> 54
7 -> 55
8 -> 56
9 -> 57
And when subtracting the '0' from them the result is their corresponding decimal values:
0 -> 48 - 48 = 0
1 -> 49 - 48 = 1
2 -> 50 - 48 = 2
3 -> 51 - 48 = 3
4 -> 52 - 48 = 4
5 -> 53 - 48 = 5
6 -> 54 - 48 = 6
7 -> 55 - 48 = 7
8 -> 56 - 48 = 8
9 -> 57 - 48 = 9