c语言中显示各种数据类型的大小。
#include <stdio.h> int main(void) { //char type printf("char: %zd. ", sizeof(char)); //integer type printf("short: %zd. ", sizeof(short)); printf("int: %zd. ", sizeof(int)); printf("long: %zd. ", sizeof(long)); printf("long long: %zd. ", sizeof(long long)); //float type printf("float: %zd. ", sizeof(float)); printf("double: %zd. ", sizeof(double)); printf("long double: %zd. ", sizeof(long double)); return 0; }