Difference between int and signed int declaration

前端 未结 2 1533
执笔经年
执笔经年 2021-01-01 18:50

I am reading some tutorials on embedded programming and one of them says int and signed int are different but does not explain how or why.

相关标签:
2条回答
  • 2021-01-01 19:16

    As far as I know the difference exists only for char data type. Where char a; can be signed char a; or unsigned char a; depending on compiler options. As this article says. (--signed_chars) For int data types, there is no difference between int and signed int.

    0 讨论(0)
  • 2021-01-01 19:30

    It is for historical reasons only. Today whenever you declare int you get a signed int. The only point where you might see a difference even with today's compilers is with char versus signed char which are different by specification (and notable when assigning a literal string) but not with int.

    0 讨论(0)
提交回复
热议问题