数据类型及其空间大小,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
", sizeof(double));
	printf("size float = %d
", sizeof(float));

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

	printf("size S_DATA = %d
", 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 . . .
*/
原文地址:https://www.cnblogs.com/mylinux/p/4629882.html