C ++ requires ([lex.charset] / 3) that in the base character set the digits '0' , '1' , '2' , ..., '9' are encoded as adjacent values. This means that given the numeric character c you can calculate its integral value as the expression c - '0' .
Kerrek SB
source share