I am not sure which one is which one, but here:


所有跟贴·加跟贴·新语丝读书论坛

送交者: steven 于 2009-03-12, 13:41:56:

回答: 32767+1, one more time 由 JJZ 于 2009-03-12, 12:41:52:

first of all, ANSI C did not specify the range of int till C99 which is ISO/IEC C. To say ANSI C range of int to be ... is incorrect. Also, C compiler represent signed integer in two's complement, the range should have been -32768 to 32767.

代码:

  short i = 32767;
  printf ("%d ", i);
  i++;
  printf ("%d\n", i);

you get

代码:

32767 -32768




所有跟贴:


加跟贴

笔名: 密码: 注册笔名请按这里

标题:

内容: (BBCode使用说明