结构体的大小

#include "stdafx.h"
#include <iostream>
using namespace std;

struct A{
    int i[100];
};

struct B{
    void f();
};

void B::f(){

}

struct C{
    
};

int _tmain(int argc, _TCHAR* argv[])
{
    cout<<sizeof(A)<<endl;    //400
    cout<<sizeof(B)<<endl;    //1   就好像只是占个位置一样
    cout<<sizeof(C)<<endl;    //1
    return 0;
}

 

posted on 2016-03-24 08:38  各种笔记  阅读(189)  评论(0编辑  收藏  举报