• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            MyMSDN

            MyMSDN記錄開發新知道

            C語言位域

            這個概念顯然是知道的,不過剛才忘了,然后寫了個程序就明白了,記錄一下,也許以后又健忘了:
             1 #include <stdio.h>
             2 typedef struct _SimpleType1 {
             3     int Variable1;    //4bytes(32bits)
             4     int Variable2;    //4bytes(32bits)
             5     int Variable3;    //4bytes(32bits)
             6     int Variable4;    //4bytes(32bits)
             7 } SimpleType1;
             8 
             9 typedef struct _ComplexType1 {
            10     int Variable1 : 8;    //1bytes(8bits)
            11     int Variable2 : 8;    //1bytes(8bits)
            12     int Variable3 : 8;    //1bytes(8bits)
            13     int Variable4 : 8;    //1bytes(8bits)
            14 } ComplexType1;
            15 
            16 typedef struct _ComplexType2 {
            17     int Variable1 : 8;    //1bytes(8bits)
            18     int Variable2 : 8;    //1bytes(8bits)
            19     int Variable3 : 8;    //1bytes(8bits)
            20     int Variable4 : 8;    //1bytes(8bits)
            21     int Variable5 : 1;    //0.125bytes(1bits) but the it also hold 32bits 
            22 } ComplexType2;
            23 
            24 int main(void){
            25     printf("sizeof SimpleType1 = %d\n"sizeof(SimpleType1));
            26     printf("sizeof ComplexType1 = %d\n"sizeof(ComplexType1));
            27     printf("sizeof ComplexType2 = %d\n"sizeof(ComplexType2));
            28 }
            結果:
            sizeof SimpleType1 = 16
            sizeof ComplexType1 = 4
            sizeof ComplexType2 = 8

            posted on 2009-12-30 01:02 volnet 閱讀(795) 評論(0)  編輯 收藏 引用 所屬分類: C/C++

            特殊功能
             
            97精品国产97久久久久久免费| 亚洲精品午夜国产va久久| segui久久国产精品| 久久精品亚洲乱码伦伦中文| 区久久AAA片69亚洲 | 久久ZYZ资源站无码中文动漫| 精品永久久福利一区二区| 久久99精品免费一区二区| 国产精品久久久久久五月尺| 国产一级做a爰片久久毛片| 久久只有这精品99| 99久久国产综合精品五月天喷水| 无码乱码观看精品久久| 久久久久久a亚洲欧洲aⅴ| 国产精品久久久久久久人人看| 婷婷久久综合九色综合98| 一本一本久久aa综合精品| 国产精品热久久毛片| 国产精品久久久久aaaa| 久久99精品久久久大学生| 久久天天躁狠狠躁夜夜av浪潮| 久久精品草草草| 97久久精品无码一区二区| 香蕉久久夜色精品升级完成| 日产久久强奸免费的看| 国产综合免费精品久久久| 国产精品99久久免费观看| 久久久久久久免费视频| 久久免费视频一区| 久久这里有精品视频| 国产激情久久久久影院小草 | 国产精品99久久99久久久| 欧美激情一区二区久久久| 亚洲精品乱码久久久久久不卡| 国产L精品国产亚洲区久久| 精品综合久久久久久97超人 | 久久国产热精品波多野结衣AV| 久久久无码精品亚洲日韩蜜臀浪潮 | 久久成人小视频| 久久免费视频1| 亚洲精品97久久中文字幕无码|