you are getting character by getchar(), But you want, integers to store.
when you enter 0 as i/p, it takes it as character 0
Character 0 has ascii value 48 ( ascii value is integer )
Character 1 has ascii value 49
.
.
Character 9 has ascii value 57
What this expression doing c - '0' ?
subtracting 48 from c ====> if you entered character 2 ===> 50
By that expression you are subtracting 48 from character 2===> 50-48=2 which is integer
If you replace it by c + '0' what happened ?
50+48 = 98 which is integer, but your array is size of 10