Negative ASCII value

前端 未结 6 1385
太阳男子
太阳男子 2020-12-09 19:33

What\'s the point of negative ASCII values?

int a = \'«\'; //a = -85 but as in ASCII table \'<<\' should be 174
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 19:54

    ASCII ranges 0..127, ANSI (also called 'extended ASCII') ranges 0..255.

    ANSI range won't fit in a signed char (the default type for characters in most compilers).

    Most compilers have an option like 'char' Type is Unsigned (GCC).

提交回复
热议问题