Simple Character Interpretation In C

后端 未结 9 924
暖寄归人
暖寄归人 2021-01-06 12:54

Here is my code

 #include

 void main()
 {
     char ch = 129;
     printf(\"%d\", ch);
 }

I get the output as -127. What d

9条回答
  •  忘掉有多难
    2021-01-06 13:30

    The char type is a 8-bit signed integer. If you interpret the representation of unsigned byte 129 in the two's complement signed representation, you get -127.

提交回复
热议问题