簡單的內存對齊

#include<stdio.h>
//#include<string.h>

#pragma   pack(8)
struct A
{
	char   c; //1byte
	double d; //8byte
	short s; //2byte
	int i; //4byte


};
int main()
{
	A strua;
	printf("%d\n",sizeof(A));
	printf("%d,%d,%d,%d\n",&strua.c,&strua.d,&strua.s,&strua.i);
	return 0;
}




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章