文章目录
- 关键概念总结:
- 1. 整数类型
- 2. 浮点类型
- 3. 字符类型
- 4. 特殊类型
- 5. 重要头文件
- 6. 字面量后缀
- 7. 格式说明符
以下是一个C语言数据类型的简明教程,包含20个代码示例:
#include<stdio.h>#include<stdbool.h>#include<limits.h>#include<float.h>intmain(){// 1. 基本整数类型intage=25;printf("1. int类型: %d\n",age);// 2. 短整数shorttemperature=-10;printf("2. short类型: %hd\n",temperature);// 3. 长整数longpopulation=7800000000L;printf("3. long类型: %ld\n",population);// 4. 长长整数longlongbigNumber=9223372036854775807LL;printf("4. long long类型: %lld\n",bigNumber);// 5. 无符号整数unsigned