Simple Character Interpretation In C

后端 未结 9 908
暖寄归人
暖寄归人 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:23

    It means you ran into undefined behavior.

    Any outcome is possible.

    char ch=129; is UB because 129 is not a representable value for a char for you specific setup.

提交回复
热议问题