Adding char and int

前端 未结 7 2058
梦如初夏
梦如初夏 2020-11-30 10:51

To my understanding a char is a single character, that is a letter, a digit, a punctuation mark, a tab, a space or something similar. And therefore when I do:

7条回答
  •  执念已碎
    2020-11-30 11:20

    A char is a disguised int. A char represents a character by coding it into an int. So for example 'c' is coded with 49. When you add them together, you get an int which is the sum of the code of the char and the value of the int.

提交回复
热议问题