int c = getchar()?

后端 未结 6 1935
予麋鹿
予麋鹿 2020-11-27 15:20

ok so im reading this book: The C Programming Language - By Kernighan and Ritchie (second Edition) and one of the examples im having trouble understanding how things are wor

6条回答
  •  天命终不由人
    2020-11-27 15:35

    Answer for your Question is answered. But just add 1 more thing.

    As you are declaring variable c as int. It is pretty clear that you are taking values from 0 to 9 having ascii value of 48-57. So you can just add 1 more line to the code-

    c = c-48.

提交回复
热议问题