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

前端 未结 4 1255
南旧
南旧 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 09:15

    I suggest writing a test program to see what the values of s[] display. You might also print out all the values for each entry in "0123456789".

    I think you'll quickly realize what it's doing, although this code is relying on ASCII encoding.

    Have fun!

提交回复
热议问题