- 看视频收获
- P2
- P3打印——printf
- P4变量
- P5常量
- P6数据类型
- sizeof 运算符
- 符号位 :signed 和 unsigned
- P7取值范围
- P8字符和字符串
- P9算术运算符
看视频收获 P2 P3打印——printf声明:小甲鱼官方链接http://fishc.com/.
统计该目录下总共打了多少行代码
gcc count_lines.c -o count_lines
./count_lines
ANSI C 32个关键字
1999——C99 又增加5个关键字
2011——C11新增7个
char —— 占用一个字节;
int —— 所用机器中的最自然长度
宏定义 —— #define 标志符(identifier) 常量
字符串结尾会自动增加一个 ‘/0’ 表示字符串结束;
printf("int = %dn",sizeof(int));
若16位操作系统中 int = 2
short x = -1;
unsigned short y = -1;
printf("%dn",x);
printf("%un",y);
P7取值范围
CPU最小单位 Byte
扩展阅读 ——进制转换——
#include#include int main() { unsigned int result = pow(2,32)-1; printf("result = %un",result);//打印 无符号类型值 用 %u return 0; } //编译 gcc -lm test.c && ./a.out //结果 result = 4294967295;
补码——扩展阅读
扩展阅读
字符串 String = “abc”; == 字符数组 char name[] = {‘a’,‘b’,‘c’,’ ’};
P9算术运算符


