开发者

Not able to understand Atoi function - *string - '0'

开发者 https://www.devze.com 2023-03-04 00:28 出处:网络
What exactly does the below statement do? const char *string *开发者_StackOverflow中文版string - \'0\'

What exactly does the below statement do?

const char *string
*开发者_StackOverflow中文版string - '0'

Thanks!


It subtracts the value of the character '0' from the character pointed to by string, turning it into a numerical value. So for example the character '9' will be turned into the integer 9.

0

精彩评论

暂无评论...
验证码 换一张
取 消