Check out example codes for "what s[i]-'0' does". It will help you in understanding the concepts better.

Code Example 1

It seems that s is a character array or a pointer to the first 
element of a character array. And element s[i] contains a character
that represents a digit as for example '5' . To convert this character
that for example in ASCII has internal code equal to 53 
(while internal code of character '0' is 48) there is used expression

s[i] -'0'
that is equivalent to

53 - 48
and equal to number 5

Code Example 2

'0' - 48
    '1' - 49
    '2' - 50
    '3' - 51
    '4' - 52
    '5' - 53
    '6' - 54
    '7' - 55
    '8' - 56
    '9' - 57

Learn ReactJs, React Native from akashmittal.com