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

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - On Gitbash - Bower : ENOGIT git is not installed or not in the PATH -