数据类型及其空间大小,vs2012实测

#include "stdafx.h"
#include <stdio.h>
#include "common.h"
#include "t4.h"

typedef struct {
	long l;
	int i[5];
	char c;
	double db;
}S_DATA;


int t4(void)
{

	printf("size double = %d\n", sizeof(double));
	printf("size float = %d\n", sizeof(float));

	printf("size long = %d\n", sizeof(long));
	printf("size long int = %d\n", sizeof(long int));
	printf("size int = %d\n", sizeof(int));
	printf("size short int = %d\n", sizeof(short int));
	printf("size short = %d\n", sizeof(short));
	printf("size char = %d\n", sizeof(char));
	printf("size char* = %d\n", sizeof(char *));

	printf("size S_DATA = %d\n", sizeof(S_DATA));


	return 0;
}
/*
size double = 8
size float = 4
size long = 4
size long int = 4
size int = 4
size short int = 2
size short = 2
size char = 1
size char* = 4
size S_DATA = 40
Press any key to continue . . .
*/

 

posted @ 2015-07-08 13:18  oucaijun  阅读(309)  评论(0编辑  收藏  举报
下载TeamViewer完整版 下载TeamViewer