首页 > 其他 > 详细

sizeof(struct)

时间:2014-10-01 19:17:11      阅读:274      评论:0      收藏:0      [点我收藏+]
#include<stdio.h>
#include<iostream>
#include<assert.h>
using namespace std;

struct s1
{
    char a;  
    char b;  
    char c;  
};
bubuko.com,布布扣
struct s2 { int a; char b; short c; }; bubuko.com,布布扣 struct s3 { char a; int b; short c; };
bubuko.com,布布扣
int main() { cout<<sizeof(s1)<<endl; cout<<sizeof(s2)<<endl; cout<<sizeof(s3)<<endl; } void func() { cout<<sizeof(char)<<endl; cout<<sizeof(short)<<endl; cout<<sizeof(int)<<endl; cout<<sizeof(long)<<endl; cout<<sizeof(float)<<endl; cout<<sizeof(double)<<endl; cout<<sizeof(char *)<<endl; cout<<sizeof(int *)<<endl; }

 

sizeof(struct)

原文:http://www.cnblogs.com/huangcongcong/p/4003430.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!