The string has the digit's ascii value. Also, the ascii values for all digits are contiguous. So to convert from the ascii value to the digit value, you can subtract the ascii value of '0'.
– L. Scott JohnsonNov 21 '20 at 18:20
The ASCII value of '0' is 48 and that of '9' is 57. Basically, any number (literal) you encounter is in between and hence the subtraction does the job.
– Abin ThomasNov 21 '20 at 18:23