马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
整点类型 short int,int, long int, long long int
浮点数类型 float, double, long double
基本类型—— 字符类型 char
指针类型 布尔类型 _Bool(只能表示真假俩种类型)
枚举类型 enum
数据类型
构造类型
空类型
sizeof运算符
sizeof运算符用于获取数据类型或表达式的长度
- sizeof(object); //sizeof(对象);
-sizeof(type_name); //sizeof(类型);
-sizeof object; //sizeof 对象;
- #include <stdio.h>
- int main()
- {
- int i;
- char j;
- float k;
- i=123;
- j='c';
- k=3.14;
- printf("size of int is %d\n", sizeof(int));
- printf("size of i is %d\n", sizeof(i));
- printf("size of char is %d\n", sizeof(char) );
- printf("size of j is %d\n", sizeof(j));
- printf("size of float is %d\n", sizeof(float));
- printf("size of k is %d\n", sizeof(k));
- return 0;
- }
复制代码打印为 size of int is 4 size of i is 4 size of char is 1 size of j is 1 size of float is 4 size of k is 4 signed(前面带负号)和unsigned (前面不带负号)
signed int unsigned int signed long [int] unsigned long [int] signed long long [int] unsigned long long [int] - #include <stdio.h>
- int main()
- {
- short i;
- unsigned short j;
- i = -1;
- j = -1;
- printf("%d\n", i);
- printf("%d\n", j);
- return 0;
- }
复制代码打印 -1 65535
|