The purpose of the code is to convert the characters '0'...'9'
into the corresponding integer values 0...9
. C does not guarantee that the characters representing decimal digits have any particular value, but it does guarantee that they are consecutive and in the correct order. The subtraction above will always give you the correct integer value.
There is no similar guarantee for any other character in C.
References
The ISO 9899:1999 Standard (aka C99) says:
The values of the members of the execution character set are implementation-defined. ...
A byte with all bits set to 0, called the null character, shall exist in the basic execution character set; it is used to terminate a character string. ...
the value of each character after 0 in the above list of decimal digits shall be one greater than the value of the previous.
Exactly the same wording is found in N1570, which was the final public draft of the current standard (C11).
Not much else is said about the values of, or relationship between characters.