摘要: 基本数据类型 1、什么是数据类型? 数据类型可以理解为固定内存大小的别名 数据类型是创建变量的模子 2、什么是变量 变量是一段(具体)连续存储空间的别名 程序通过变量申请并命名存储空间 通过变量名可以使用存储空间 3、代码练习 (1)类型与变量的关系 #include int main() { char c = 0; short s = 0; ... 阅读全文
posted @ 2018-10-24 16:37 chen_ace 阅读(99) 评论(0) 推荐(0)
摘要: 变量属性 C语言定义变量属性的关键字主要有auto、register、static、extern 1、auto关键字 2、register关键字 (1)register关键字指明将局部变量存储于寄存器中; (2)register只是请求寄存器变量,并不一定能成功; (3)register变量必须是C 阅读全文
posted @ 2018-10-23 18:02 chen_ace 阅读(149) 评论(0) 推荐(0)
摘要: 分支语句 1、if语句 2、switch语句 注:case语句中的值只能是整型或者字符型常量 3、小结 <wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;"> 来自为知笔记(Wi 阅读全文
posted @ 2018-10-23 18:02 chen_ace 阅读(131) 评论(0) 推荐(0)
摘要: 浮点数的秘密 1、内存中的浮点数表示方法 浮点数在内存中的存储方式为:符号位、指数、尾数(小数) 2、浮点数存储示例 举例:实数8.25在内存中的表示 3、编程验证 #include <stdio.h> int main() { float f = 8.25; unsigned int* p = ( 阅读全文
posted @ 2018-10-23 18:01 chen_ace 阅读(166) 评论(0) 推荐(0)
摘要: 类型转换 C语言中类型转换一般有强制类型转换与隐式类型转换两种; 1、强制类型转换 强制类型转换语法: 强制类型转换结果: 编程练习: #include <stdio.h> struct TS { int i; int j; }; struct TS ts; int main() { short s 阅读全文
posted @ 2018-10-23 18:01 chen_ace 阅读(109) 评论(0) 推荐(0)
摘要: 有符号数与无符号数 1、计算机中的符号位 编程实验: #include <stdio.h> int main() { char c = -5; short s = 6; int i = -7; printf("%d\n", ( (c & 0x80) != 0 )); printf("%d\n", ( 阅读全文
posted @ 2018-10-23 18:00 chen_ace 阅读(347) 评论(0) 推荐(0)