zoukankan      html  css  js  c++  java
  • 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
    ",(char)frame_size); // 0x78
    
        printf(" hello world c is %x
    ",m.c);  // 0x78
    
        printf(" long size is  %x
    ",sizeof(long));  //
    
        return 0;
    }
    

     

    #include <stdio.h>
    #include <stdlib.h>
    
    union data
    {
        int i;
        char c;
        float f;
        long video_data;
    }a;
    
    int n;
    
    int main()
    {
    
        a.video_data = 0x123456789;
        printf("union %x
    ",a.i);
        printf("union %x
    ",a.video_data);
        return 0;
    }
    一勤天下无难事。
  • 相关阅读:
    vim python extension
    aws msk
    Install python3
    sns
    inventory
    批量添加监听端口
    template screen
    DNS name
    add jar and proxy repo
    模型诊断论文心得
  • 原文地址:https://www.cnblogs.com/nowroot/p/15365187.html
Copyright © 2011-2022 走看看