sizeof(struct)

#include<stdio.h>
#include<iostream>
#include<assert.h>
using namespace std;

struct s1
{
    char a;  
    char b;  
    char c;  
};
struct s2 { int a; char b; short c; }; struct s3 { char a; int b; short c; };
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; }

 

posted @ 2014-10-01 17:57  凡尘里的一根葱  阅读(335)  评论(0编辑  收藏  举报