标签:
#include<stdio.h> int main(void) { signed int a1; unsigned int a2; signed long int a3; unsigned long int a4; signed long long int a5; unsigned long long int a6; signed short int a7; unsigned short int a8; float a9; double a10; long double a11; char a12; _Bool a13; printf("各种数据类型所占字节数(1字节8个bit位)\n\n"); printf("signed int 有符号整数:%d字节\n", sizeof(a1)); printf("unsigned int 无符号整数:%d字节\n\n", sizeof(a2)); printf("signed long int 有符号长整数:%d字节\n", sizeof(a3)); printf("unsigned long int 无符号长整数:%d字节\n\n", sizeof(a4)); printf("signed long long int 有符号长长整数:%d字节\n", sizeof(a5)); printf("unsigned long long int 无符号长长整数:%d字节\n\n", sizeof(a6)); printf("signed short int 有符号短整数:%d字节\n", sizeof(a7)); printf("unsigned short int 无符号短整数:%d字节\n\n", sizeof(a8)); printf("float 单精度:%d字节\n", sizeof(a9)); printf("double 双精度:%d字节\n", sizeof(a10)); printf("long double 长双精度:%d字节\n\n", sizeof(a11)); printf("char 字符型:%d字节\n\n", sizeof(a12)); printf("_Bool 布尔型:%d字节\n", sizeof(a13)); getchar(); return 0; }
标签:
原文地址:http://www.cnblogs.com/Ahair/p/5008880.html