c语言共用体的使用和long类型长度

#include <stdio.h>
#include <stdlib.h>

int main()
{
    long frame_size = 0x12345678;

    union
    {
        int a;
        long b;
        char c;
    }m;

    m.b = 0x12345678;

    printf("Hello world! frame_size is %x\n",(char)frame_size); // 0x78

    printf(" hello world c is %x\n",m.c);  // 0x78

    printf(" long size is  %x\n",sizeof(long));  //

    return 0;
}

 c语言共用体的使用和long类型长度

 

上一篇:大小端的区分


下一篇:XCTF no-strings-attached