I\'m trying to read unknown number of integers by this piece of code:
while (1) {
int c = getchar ();
if (c == EOF)
break;
el
The digits are represented in ASCII by increasing values: 0
is 48, 1
is 49, and so on. Since characters in C
are just integers in disguise, you can subtract the ASCII value of 0
from any other digit to obtain the numerical value of the digit. For example, '1' - '0'
is the same as 49 - 48
which is 1
.