c - What does s[i] - '0' mean? -


the following code k&r textbook, page number 71:

val =10.0*val+s[i] -'0' 

what s[i] -'0' mean here?

it converts int in char form actual int.

for example, if s[i] '9' s[i] - '0' produce 9.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -