实验一:在屏幕上输出您使用的编译器对如下数据类型所分配的存储字节数:char, unsigned char,short int, int, long int, long long int,unsigned short int, unsigned int, unsigned long int, unsigned long long int, float, double, long double。
源程序
#include <stdio.h>
int main(void)
{
printf(“size of char type is %d btyes \n”,sizeof(char));
printf(“size of unsigned char type is %d btyes \n”,sizeof(unsigned char));
printf(“size of short int type is %d btyes \n”,sizeof(short int));
printf(“size of int type is %d btyes \n”,sizeof(int));
printf(“size of long int type is %d btyes \n”,sizeof(long int));
printf(“size of long long int type is %d btyes \n”,sizeof(long long int));
printf(“size of unsigned short int type is %d btyes \n”,sizeof(unsigned short int));
printf(“size of unsigned int type is %d btyes \n”,sizeof(unsigned int));
printf(“size of unsigned long int type is %d btyes \n”,sizeof(unsigned long int));
printf(“size of unsigned long long int type is %d btyes \n”,sizeof(unsigned long long int));
printf(“size of float type is %d btyes \n”,sizeof(float));
printf(“size of double type is %d btyes \n”,sizeof(double)); printf(“size of long double type is %d btyes \n”,sizeof(long double));
return 0;
}