當前位置:編程學習大全網 - 電腦編程 - unsigned int b=65535;printf("%d",b);

unsigned int b=65535;printf("%d",b);

其實 long 型是4個字節,short 是2個字節,byte是1個字節。

但 int 是變長的,16機是16位(2字節),32位機就是32位(4字節),64位機就是64位(8字節)。現在很多學校還在用非常老的教材,說 int 是占2個字節。

我想樓主可能是認為 int 是2個字節 ,16位全為1的時候是 65535 ,而加了個 unsigned 變成了無符號整數了,就搞不清楚輸出什麽結果了。其實,實際運行妳會發現,無論加不加 unsigned ,輸出的都是 65535。如果換成

short b=65535;

將會輸出 -1

而 unsigned short b=65535; 則輸出 65535 。

  • 上一篇:福建師大二附中官網進不去
  • 下一篇:德州熟食培訓班哪家好 熟食培訓
  • copyright 2024編程學習大全網