最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

求32位機器上unsigned int的最大值及int的最大值的解決方法

 更新時間:2013年05月31日 17:35:45   作者:  
本篇文章是對求32位機器上unsigned int的最大值及int的最大值的解決方法進行了詳細的分析介紹,需要的朋友參考下
復制代碼 代碼如下:

#include <stdio.h>
int main(int argc, char *argv[])
{
 unsigned int max_int = 0-1;
 printf("The max value of unsigned int on 32 machine: %u/n", max_int);
}

復制代碼 代碼如下:

#include <stdio.h>
int main(int argc, char *argv[])
{
 unsigned int max_int = 0-1;
 printf("The max value of unsigned int on 32 machine: %u/n", max_int);
}

gcc編譯后:
int_sizeof1.c: 在函數(shù)‘main'中:
int_sizeof1.c:5: 警告:整數(shù)溢出
運行后:
The max value of int on 32 machine: 4294967295
 
VC6.0和java編譯后,無錯誤。
運行后:
The max value of int on 32 machine: 4294967295
復制代碼 代碼如下:

#include <stdio.h>
int main(int argc, char *argv[])
{
 int max_int = (1<<31)-1;
 printf("The max value of int on 32 machine: %d/n", max_int);
}

將其int寫成有符號型的程序如下:
復制代碼 代碼如下:

#include <stdio.h>
int main(int argc, char *argv[])
{
 int max_int = (1<<31)-1;
 printf("The max value of int on 32 machine: %d/n", max_int);
}

gcc編譯后:
int_sizeof1.c: 在函數(shù)‘main'中:
int_sizeof1.c:5: 警告:整數(shù)溢出
運行后:
The max value of int on 32 machine: 2147483647
VC6.0和java編譯后,無錯誤。
運行后:
The max value of int on 32 machine: 2147483647
因為int的最高位是符號位。
您可能感興趣的文章:

相關文章

最新評論

梅河口市| 沙雅县| 沙洋县| 安仁县| 镶黄旗| 萍乡市| 兴国县| 贺兰县| 隆昌县| 灵台县| 吕梁市| 民县| 靖宇县| 任丘市| 伊宁市| 江山市| 上饶县| 辉县市| 山西省| 来宾市| 秦皇岛市| 宁河县| 天峨县| 平泉县| 钟山县| 宿松县| 长阳| 洪江市| 买车| 汉源县| 兴义市| 临汾市| 天峨县| 南丰县| 石棉县| 西盟| 吕梁市| 齐齐哈尔市| 乌拉特中旗| 图木舒克市| 慈溪市|