日韩精品中文字幕一区二区-日韩精品中文字幕一区-日韩精品中文字幕视频-日韩精品在线一区二区三区-第一页在线-第一福利视频

當(dāng)前位置: 首頁IT技術(shù) → sizeof 的使用讓程序多一個標(biāo)記

sizeof 的使用讓程序多一個標(biāo)記

更多

#include #include int main() { struct { int a ; char b ; int c ; } a,*b; int d; char f; float g; double h; printf("sizeof(a) = %d,sizeof(b) = %d ,sizeof(*b) = %d\n",sizeof(a),sizeof(b),sizeof(*b)); printf("sizeof(&d) = %d ,sizeof(&f) = %d ,sizeof(&g) = %d,sizeof(&h) = %d\n",sizeof(&d),sizeof(&f),sizeof(&g),sizeof(&h)); printf("sizeof(d) = %d ,sizeof(f) = %d ,sizeof(g) = %d,sizeof(h) = %d\n",sizeof(d),sizeof(f),sizeof(g),sizeof(h)); }

上面程序輸出的結(jié)果為:

sizeof(a) = 12,sizeof(b) = 8 ,sizeof(*b) = 12 sizeof(&d) = 8 ,sizeof(&f) = 8 ,sizeof(&g) = 8,sizeof(&h) = 8 sizeof(d) = 4 ,sizeof(f) = 1 ,sizeof(g) = 4,sizeof(h) = 8 在系統(tǒng)中 sizeof( char *)、sizeof( int *)、sizeof( float *)、sizeof( double *) 的長度均為8所以在sizeof時千萬要注意,使用不當(dāng)會出現(xiàn)錯誤; 我的使用的是系統(tǒng)和編譯器為:[struggle@struggle alloc]$ cc -v 使用內(nèi)建 specs。 COLLECT_GCC=cc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/lto-wrapper 目標(biāo):x86_64-redhat-linux 配置為:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 線程模型:posix gcc 版本 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) [struggle@struggle alloc]$ uname -a Linux struggle 2.6.35.13-91.fc14.x86_64 #1 SMP Tue May 3 13:23:06 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux [struggle@struggle alloc]$

熱門評論
最新評論
發(fā)表評論 查看所有評論(0)
昵稱:
表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
字?jǐn)?shù): 0/500 (您的評論需要經(jīng)過審核才能顯示)
主站蜘蛛池模板: 英语书七年级下册单词表| 黄祖蓝| 杨在葆个人资料简介| 诈欺游戏电影| 外国开船戏原声| 林安| 林峰电影| 陈奂生上城| 消防给水及消火栓技术规范gb50974-2014 | 成毅壁纸| 抖音浏览器| 仲村美宇| 《假期》电影| 谢容儿| 那些年,那些事 电视剧| 电影《忌讳》完整版| 红灯停绿灯行电影观看| 团结就是力量歌词完整| 奔跑吧第13季| 久久久在线视频| junk boy| 《x教程》韩剧免费观看| 搭错车演员表| 月光奏鸣曲第三乐章钢琴谱| 女女床戏| 五年级上册语文课时练答案 | 帅克| 教育在线教育平台直播| 蒋锐| 卡通图片头像| 三大| 珠江电视台直播 珠江频道| 热爱 电影| 树屋轻调| 红电视剧演员表| 汤晶锦| 黄梅戏龙女全剧播放| 第八种爱情演员表| 故都的秋ppt| 抖音1| 常虹|