Please explain what this code is doing (someChar - 48)

前端 未结 4 1254
南旧
南旧 2021-01-05 08:14

I\'m going through some practice problems, and I saw this code:

#include 
#include 

int main(void) {
   char* s = \"357\";
           


        
4条回答
  •  失恋的感觉
    2021-01-05 08:49

    Finding the sum of the numbers in the string s.

    The sum += s[i] - 48; converts ASCII characters to their numeric values.

提交回复
热议问题