您的位置:首页 > 编程语言 > C语言/C++

C语言实验一:在屏幕上输出您使用的编译器对如下数据类型所分配的存储字节数:char, unsigned char,short int , int, long int, long long int, 等

2020-06-22 04:26 741 查看

实验一:在屏幕上输出您使用的编译器对如下数据类型所分配的存储字节数: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;
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐