If I want to convert a single numeric char
to it's numeric value, for example, if:
char c = '5';
and I want c
to hold 5
instead of '5'
, is it 100% portable doing it like this?
c = c - '0';
I heard that all character sets store the numbers in consecutive order so I assume so, but I'd like to know if there is an organized library function to do this conversion, and how it is done conventionally. I'm a real beginner :)