2.21作业

64位/32位
struct data{    
    char t1;        
    char t2;        
    unsigned short t3;    
    unsigned long t4;   
};  16 /8
 
struct data{ 
    char t1; 
    int t2;    
    short t3; 
}; 12 /12
struct s1 { 
    char c1; 
    int i; 
    char c2;   
};12 /12
 
struct s2 { 
    char c1; 
    char c2; 
    int i;     
};8 /8
 
typedef struct Test 

    short a; 
    struct { 
    int b; 
    double c; 
    char d; 
    }p;   
    int e;   
}Test;  40/24
 
typedef struct Test 

    short a; 
    struct { 
    int b; 
    double c[10]; 
    char d; 
    }; 
    int e;   
}Test;112 /96
struct C{ 
    char b; 
    int a;    
    short c;     
}; 12   /12
struct C {    
    char a;     
    char b[3];      
    char c;   
};  5 /5
typedef struct 
{   
    int b;       
    char a;        
    long e;        
    char c;        
    float d;      
    double t;   
}node; 32  /28

验证大小端

int main(int argc, const char *argv[])
{
    int a=0x12345678;
    char*p=(char*)&a;
    if(*p==0x78){
        printf("小端存储\n");
    }else printf("大端存储\n");
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值