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

php - Hide output during test execution -

javascript - Migrate custom AngularJS filter from 1.2.28 to 1.4.x -

Update Magento products with multiple images -