c语言中,数据类型指的是用于声明不同类型的变量或函数;变量的类型决定了变量存储占用的空间。
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("void 存储大小 :%d\n", sizeof(void));
printf("char 存储大小 :%d\n", sizeof(char));
printf("unsigned char 存储大小 :%d\n", sizeof(unsigned char));
printf("short 存储大小 :%d\n", sizeof(short));
printf("unsigned short 存储大小 :%d\n", sizeof(unsigned short));
printf("int 存储大小 :%d\n", sizeof(int));
printf("unsigned int 存储大小 :%d\n", sizeof(unsigned int));
printf("long 存储大小 :%d\n", sizeof(long));
printf("unsigned long 存储大小 :%d\n", sizeof(unsigned long));
printf("float 存储大小 :%d\n", sizeof(float));
printf("double 存储大小 :%d\n", sizeof(double));
printf("long int 存储大小 :%d\n", sizeof(long int));
printf("long long 存储大小 :%d\n", sizeof(long long));
printf("long double 存储大小 :%d\n", sizeof(long double));
return 0;
}
void 存储大小 :1
char 存储大小 :1
unsigned char 存储大小 :1
short 存储大小 :2
unsigned short 存储大小 :2
int 存储大小 :4
unsigned int 存储大小 :4
long 存储大小 :4
unsigned long 存储大小 :4
float 存储大小 :4
double 存储大小 :8
long int 存储大小 :4
long long 存储大小 :8
long double 存储大小 :16
转载注明:
感谢博主,喝杯咖啡~
感谢博主,喝杯咖啡~
还没有人发表评论