码迷,mamicode.com
首页 > 其他好文 > 详细

结构体所占字节大小计算以及共用体大小计算

时间:2018-04-27 21:14:40      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:技术   分享图片   article   str   pre   分享   \n   png   并且   

#include<stdio.h>
  struct student{
 int num;
 char sex;
 float score;
} ;
  union data{
  int k;
  char ch;
  float f;
};
 int main(void){
  printf("%d\n",sizeof(struct student));
  printf("%d",sizeof(union data));
}

    技术分享图片

    详细计算见:https://blog.csdn.net/u012807459/article/details/48545141  博客,写的很好。规则要理解并且记下来。

     

 

结构体所占字节大小计算以及共用体大小计算

标签:技术   分享图片   article   str   pre   分享   \n   png   并且   

原文地址:https://www.cnblogs.com/sunnybowen/p/8964182.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!