C和指针 的读书笔记(自己整理)

news/2024/5/19 1:27:06 标签: 读书, c, math.h, 存储, struct, null
cle class="baidu_pl">
cle_content" class="article_content clearfix">
content_views" class="htmledit_views">

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">第2cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">章

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">环境:翻译环境: cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">源代码转化成可执行的机器指令。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">执行环境:用于实际执行代码。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">翻译:源文件-cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">〉目标文件-cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">〉可执行文件(通过链接器将多个目标文件捆绑在一起)

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">编译过程:预处理器-cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">〉源代码经过解析产生目标代码(这个过程中是绝大多数错误和警告产生的地方)-cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">〉优化器(就是对目标代码进行进一步优化࿰c;使效率更高)

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">执行:首先࿰c;程序被加载到内存࿰c;那些不是存储在栈中的未被初始化的变量将在这个时候被初始化;然后࿰c;程序的执行便开始了࿰c;负责处理一些日常事务࿰c;如收集命名行参数以便使程序能够访问他们࿰c;并开始调用maincii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数;现在࿰c;开始执行程序代码࿰c;在绝大多数机器里࿰c;程序将使用一个运行时堆栈࿰c;用于存储函数的局部变量和返回地址。程序同时也使用静态内存࿰c;存储与静态内存中的变量在整个程序执行过程中将一直保持不变。最后࿰c;程序终止࿰c;正常终止的话࿰c;是maincii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数返回。

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;">2.2cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">词法规则

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">三字母符 ??

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">转义序列cerun: yes;">  /

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">注释:注意1.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">别把代码给错误的注释掉了2.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">别在结尾写成了*cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">?

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">标志符:

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">编程风格:

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">空行用于分隔不同的逻辑代码段࿰c;它们是按照功能分段的。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">Ifcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">和相关语句的括号是这些语句的一部分࿰c;而不是他所测试的表达式的一部分。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">在绝大多数的操作符使用中࿰c;中间都隔以空格࿰c;复杂的操作符中省略空格࿰c;这样有助于显示表达式的分组。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">绝大多数注释都是称快出现的࿰c;因为这样比较能引起注意。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">在函数的定义中࿰c;返回类型出现于独立的一行中࿰c;而函数的名字则在下一行的起始处。

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">第三章 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">数据

class="MsoNormal" style="margin: 0cm 0cm 0pt;">1.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">长整型至少和整型一样长࿰c;整型至少和短整型一样长。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">2.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">可移植性问题:把存储charcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">变量的值࿰c;限制在signed char cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">和unsigned char cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">两者的交集之中࿰c;这样可以获得最大程度的可移植性࿰c;又不牺牲效率。并且只有当char cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">类型显示声明为signed cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">或 unsignedcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';"> 时࿰c;才对它执行算术运算。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">3.使用字符常量所产生的都是正确的值࿰c;所以它能提高程序的可移植性。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">4.枚举类型:如果没有对一个值赋值࿰c;那么它的值是前面这个值的数+1

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">5.指针:选择NU࿲c;作为字符串的终止符的原因是因为它是一个可打印的字符。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">如果你想修改字符串请先把它存在字符数组中。字符串常量的直接值是一个指针࿰c;而不是这些字符本身。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">3.2基本声明

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">声明简单数组࿰c;c数组另一个值得关注的地方是࿰c;编译器并不检查程序对数组下标的引用是否在数组的合法范围之内。如果下标值是从那些已知正确的值计算而来࿰c;那么就无需检查它的值࿰c;如果一个用作下标的值是根据某种方法从用户输入的数据产生而来的࿰c;那么使用它之前必须进行检测࿰c;确保它位于有效的范围之内。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">第五章 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">操作符

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">注意:1.注意检查if 和whi࿴c;e中=和==的区别。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">   2.断路求值

class="MsoNormal" style="margin: 0cm 0cm 0pt;">count: 1;">       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';"> 3.条件操作符的优势

class="MsoNormal" style="margin: 0cm 0cm 0pt;">count: 1;">       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';"> 4.逗号表达式的使用场合和它的一个小技巧

class="MsoNormal" style="margin: 0cm 0cm 0pt;">count: 1;">       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';"> 5.下标引用:总是从0开始࿰c;不对下标进行有效性检验

class="MsoNormal" style="margin: 0cm 0cm 0pt;">count: 1;">       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';"> 6.避免混合使用整形值和布尔值

class="MsoNormal" style="margin: 0cm 0cm 0pt;">count: 1;">       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';"> 7.左值和右值的区别:左值必须应该指定一个固定的位置࿰c;左值意味着一个位置࿰c;而右值意味着一个值

class="MsoNormal" style="margin: 0cm 0cm 0pt;">count: 1;">       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';"> 8.操作符的优先级是决定相邻操作符之间谁先计算࿰c;谁后计算

class="MsoNormal" style="margin: 0cm 0cm 0pt;">count: 1;">       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';"> 9.如果顺序会对导致结果产生区别࿰c;最好使用临时变量

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -42pt; mso-list: l1 level1 lfo1; tab-stops: list 42.0pt;">第六章       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指针

class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt; text-indent: -21pt; mso-list: l8 level1 lfo2; tab-stops: list 21.0pt;">1.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">在对指针进行间接访问之前࿰c;必须先对指针进行初始化

class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt; text-indent: -21pt; mso-list: l8 level1 lfo2; tab-stops: list 21.0pt;">2.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">NU࿲c;࿲c;指针给了一种方法࿰c;表示某个特定的指针目前没有指向任何东西࿰c;对NULLcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指针进行间接引用是非法的

class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt; text-indent: -21pt; mso-list: l8 level1 lfo2; tab-stops: list 21.0pt;">3.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">如果已经知道指针将被初始化为何种地址࿰c;就将该指针初始化为该地址࿰c;如果没有将指针初始化为NULLcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指针

class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -42pt; mso-list: l1 level1 lfo1; tab-stops: list 42.0pt;">第七章       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l2 level1 lfo3; tab-stops: list 18.0pt;">1.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数中 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">传值调用和传址调用的区别

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l2 level1 lfo3; tab-stops: list 18.0pt;">2.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">黑盒不怎么明白

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l2 level1 lfo3; tab-stops: list 18.0pt;">3.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">递归函数的两个条件:(1cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">).cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">有限制条件(2cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">).cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">每次操作后越来越接近这个限制条件

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l2 level1 lfo3; tab-stops: list 18.0pt;">4.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">递归函数运行设计一些开销:参数必须压到堆栈中࿰c;为局部变量分配内存空间

class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -42pt; mso-list: l1 level1 lfo1; tab-stops: list 42.0pt;">第八章       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">数组

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">1.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">数组名是指向某种类型的指针常量࿰c;表示数组第一个元素的地址

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">2.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">下标绝不会比指针更有效率࿰c;指针有时会比下标更有效率

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">3.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">当你根据某个固定的数目在一个数组中移动时࿰c;使用指针代码将比使用下标产生更加有效率的代码࿰c;当这个增量是1cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">࿰c;并且机器具有地址自动增量模型时࿰c;这点表现更加突出。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">4.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">声明为寄存器的指针比静态内存和堆栈中的指针效率更高

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">5.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">如果你可以通过测试一些已经初始化并经过调整的内容来判断循环是否终止࿰c;那么你就不需要一个单独的计数器。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">6.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数中的形式参数传递的是数组时࿰c;不指定数组大小的原因是因为数组传递的时候是以指针的形式传递的。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">7.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">多位数组的名称表示的是࿰c;指向第一个数组的指针

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">8.       max[3,4]cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">等价于max[3]

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">9.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">多维数组中初始化时࿰c;记得要把花括号加上(更容易区分࿰c;还有就是可以给缺少元素的初始化为0cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">)

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l4 level1 lfo4; tab-stops: list 18.0pt;">10.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">只要有可能函数的形式参数都应该声明为const

class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -42pt; mso-list: l1 level1 lfo1; tab-stops: list 42.0pt;">第九章       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">字符串

class="MsoNormal" style="margin: 0cm 0cm 0pt;">1.

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt 42pt; text-indent: -42pt; mso-list: l1 level1 lfo1; tab-stops: list 42.0pt;">第十章       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">结构和联合

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l7 level1 lfo5; tab-stops: list 18.0pt;">1.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">如果你想在多个元文件中使用同一类型的数据结构࿰c;你应该把标签生命或typedefcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">形式的声明放在一个头文件中。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l7 level1 lfo5; tab-stops: list 18.0pt;">2.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">结构成员可以是标量࿰c;数组࿰c;指针甚至是其他结构

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l7 level1 lfo5; tab-stops: list 18.0pt;">3.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">下标操作和点操作具有相同的优先级࿰c;都是从左到右进行操作。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l7 level1 lfo5; tab-stops: list 18.0pt;">4.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指针对结构内的数据的调用࿰c;采用两种操作符࿰c;点操作和-cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">〉操作。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l7 level1 lfo5; tab-stops: list 18.0pt;">5.       struct sample{

class="MsoNormal" style="margin: 0cm 0cm 0pt;">int a ;

class="MsoNormal" style="margin: 0cm 0cm 0pt;">sample *b;

class="MsoNormal" style="margin: 0cm 0cm 0pt;">};cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">是合法的

class="MsoNormal" style="margin: 0cm 0cm 0pt;">struct sample{

class="MsoNormal" style="margin: 0cm 0cm 0pt;">int a ;

class="MsoNormal" style="margin: 0cm 0cm 0pt;">samplecerun: yes;">  b;

class="MsoNormal" style="margin: 0cm 0cm 0pt;">};cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">是不合法的

class="MsoNormal" style="margin: 0cm 0cm 0pt;">Typedef struct sample{

class="MsoNormal" style="margin: 0cm 0cm 0pt;">int a ;

class="MsoNormal" style="margin: 0cm 0cm 0pt;">sample *b;

class="MsoNormal" style="margin: 0cm 0cm 0pt;">} sample;cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">是合法的

class="MsoNormal" style="margin: 0cm 0cm 0pt;">Typedef struct {

class="MsoNormal" style="margin: 0cm 0cm 0pt;">int a ;

class="MsoNormal" style="margin: 0cm 0cm 0pt;">sample *b;

class="MsoNormal" style="margin: 0cm 0cm 0pt;">} sample;cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">是非法的

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l7 level1 lfo5; tab-stops: list 18.0pt;">6.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">注意结构的不完整声明

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">第十一章cerun: yes;">  cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">动态内存分配

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">1.       malloc cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数用来实现从内存中提取一块合适的内存࿰c;并向该程序返回一个指向这个内存的指针。这块内存现在并没有进行任何初始化。当一块以前使用的内存没有使用的时候࿰c;程序调用freecii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数将它归还给内存池供以后使用。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">2.       malloccii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数当没有内存可以分配时࿰c;就会返回一个nullcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指针࿰c;所以对nullcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指针的判断很重要。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">3.       malloccii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">和calloccii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">的区别:一是࿰c;后者在返回指针之前先把内存初始化为0cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">;二是࿰c;calloccii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">包括需要元素的数量和每个元素的字节数࿰c;根据这个值࿰c;它能计算出到底需要分配多少内存。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">4.       realloccii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">用于修改原先已经分配好的内存大小。可以扩大也可以缩小࿰c;扩大时࿰c;前面的存储内容不变࿰c;后面的不被初始化;缩小时࿰c;尾部的内存便被砍掉。如果原先的内存不能改变大小࿰c;该函数将会重新分配一块新的内存࿰c;将原先的内存中的内容复制过来。因此使用realloc cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">后就不能在使用指向旧内存的指针了࿰c;而是应该使用realloc cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">返回的的新指针。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">5.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">如果偶尔调用了malloccii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">࿰c;程序将由于语法错误而无法编译࿰c;在alloccii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">中必须加入#undefcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指令࿰c;这样他才能调用malloc cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">而不至于出现语法错误。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">6.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">操作内存时超出了分配内存的边界。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">7.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">传递给freecii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">的指针必须是malloc alloc,realloc cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">返回的指针࿰c;让他释放一个非动态分配的内存可导致程序立即终止或在晚些时候终止。试图释放动态内存的一部分内存也会出现同样的错误。动态分配的内存必须整块释放。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">8.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">不要使用已经被释放的内存。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">9.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">分配的内存在使用完毕后不进行释放将会产生内存泄露。一个持续分配却一点都不是放内存的程序最终将耗尽可用的内存。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l9 level1 lfo6; tab-stops: list 18.0pt;">10.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">动态分配内存一个常见的用途就是为那些运行时才知道长度的数组分配内存空间。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">第十二章 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">使用结构和指针

class="MsoNormal" style="margin: 0cm 0cm 0pt;">1. cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">在链表中࿰c;每个节点包含一个链表下一个节点的指针࿰c;连表最后一个指针字段的值为null

class="MsoNormal" style="margin: 0cm 0cm 0pt;">2. cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">为了记住链表的起始位置࿰c;可以使用一个根指针(root pointercii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">)࿰c;跟指针指向链表的第一个节点。。注意跟指针只是一个指针࿰c;它不包含任何数据。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">3. cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">事实上链表的节点可以存储在内存的各个地方

class="MsoNormal" style="margin: 0cm 0cm 0pt;">4. cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">链表中如果你想遍历其他的节点࿰c;你只能从根节点开始。可以对链表进行排序

class="MsoNormal" style="margin: 0cm 0cm 0pt;">5.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">语句提炼 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">:如果语句对ifcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">语句执行没有影响我们可以将这个语句提前࿰c;如果语句在ifcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">执行后对这条语句没有影响࿰c;可以将这条语句放到后面。

class="MsoNormal" style="margin: 0cm 0cm 0pt;">6.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">双链表插入逻辑的提炼

class="MsoNormal" style="margin: 0cm 0cm 0pt;">7.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">不要仅仅以代码的大小衡量代码的效率

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">第十三章:高级指针话题

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">1.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指针的多层间接访问

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">2.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数指针

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">3.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数只能返回标量值࿰c;不能返回数组

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">4.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">对函数指针进行操作之前࿰c;必须把它初始化为指向某个函数࿰c;函数指针的初始化也可以通过赋值操作进行完成;在函数指针的初始化之前࿰c;具有函数的原型是很重要的

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">5.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数指针的两个作用:函数指针作为参数传递给另外一个函数࿰c;用作转移表

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">6.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">回调函数

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">7.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">把具体操作和选择操作份开始一个良好的程序设计方案

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">8.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">命令行参数

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">9.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">当一个字符串常量出现在一个表达式中时࿰c;它的值是个指针常量࿰c;便一起把这些字符的一份拷贝存储在内存的一个位置࿰c;并存储一个指向第一个字符的指针。*cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">“xyzcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">”表示的是x

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">10.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">字符串常量的指针是“指向字符的指针“

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">11.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">神秘函数

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">12.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">如果没有必要࿰c;避免使用多层间接访问

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">13.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">使用转移表时应该检验下标的有效性

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l0 level1 lfo7; tab-stops: list 18.0pt;">14.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">不同寻常的代码应该加上相应的注释

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">第十四章 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">预处理器

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l3 level1 lfo8; tab-stops: list 18.0pt;">1.       ccii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">与处理器要做的事情:删除注释࿰c;插入#includecii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">包含的内容文件的内容࿰c;定义和#definecii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指令定义的符号以及确定代码的部分内容是否应该根据一些条件编译 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">指令进行编译

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l3 level1 lfo8; tab-stops: list 18.0pt;">2.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">如果定义的stufcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">比较长可以分开成几行࿰c;不过除了最后一行外其他的几行都应该在后面加上/,cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">并且不要加上;cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">号

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l3 level1 lfo8; tab-stops: list 18.0pt;">3.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">所有对数值表达式进行求值的宏定义都应该用这种方式加上括号࿰c;避免由于宏被替换时被不必要的操作符和临近的操作符之间不可预料的相互作用

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l3 level1 lfo8; tab-stops: list 18.0pt;">4.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">宏不可以出现递归

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l3 level1 lfo8; tab-stops: list 18.0pt;">5.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">宏适于类型无关的

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l3 level1 lfo8; tab-stops: list 18.0pt;">6.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">具有副作用的宏

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l3 level1 lfo8; tab-stops: list 18.0pt;">7.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">宏的命名约定:一种方式是 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">都大写࿰c;

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l3 level1 lfo8; tab-stops: list 18.0pt;">8.       #undef cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">用于移出一个宏定义

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l3 level1 lfo8; tab-stops: list 18.0pt;">9.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">命令行的定义

class="MsoNormal" style="margin: 0cm 0cm 0pt;"> 

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">第十五章 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">输入输出函数

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">1.       ascncii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">编码器并未被禁止在它们的库函数的基础上添加新的函数࿰c;但是标准函数必须根据标准所定义的方式执行。如果你关心可移植性只要避免使用费标准函数就行了。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">2.       perror cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">以一种简单࿰c;统一的方式报告错误

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">3.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">良好的编程实践要求任何可能产生错误的操作࿰c;都应该在执行之后进行检查࿰c;确定它是否成功。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">4.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">注意只有当库函数失败时࿰c;errnocii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">才能被设置࿰c;当函数成功运行时࿰c;errnocii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">的值不会被修改。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">5.       exit cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数中的参数和maincii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">中的参数状态是一致的࿰c;用于提示程序是否正常完成࿰c;这个函数没有返回值࿰c;当exitcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">结束时࿰c;程序已经消失࿰c;所以他无返回值而言。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">6.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">标准i/ocii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数库还引用了缓存i/ocii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">的概念࿰c;提高了绝大多数程序的效率

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">7.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">这个函数库存在两个缺点:1cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">。它在某种特定的类型的机器上实现的࿰c;并没有对其他不同特性的机器多作考虑。2.cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">设计这发现上述问题后࿰c;试图去修正࿰c;但是只要他们这么作了这个函数库就不标准了࿰c;程序的可移植性就会降低。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">8.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">使用标准 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">输入输出时࿰c;这种缓存坑引起混淆࿰c;只有当他们与交互设备并无联系时࿰c;才会进行完全缓存。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">9.       cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">事实上࿰c;如果程序失败࿰c;缓存奴输出可能不被写入࿰c;这就可能使得关于程序出现错误的位置不正确࿰c;这个的解决方法是在用于调适的printfcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">后面加上fflush, fflushcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">迫使缓存区的内容立即写入࿰c;不管他立即已满

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">10.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">标准错误就是错误信息写入的地方

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">11.   EOFcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">所选择的实际值比一个字符要多几位

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">12.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">打开流和关闭流࿰c;对关闭流是否进行检验的标准是:问两个问题࿰c;操作成功应该执行什么 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">࿰c;操作失败应该执行什么 cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">;如果答案一样的话࿰c;可以不进行检验否则进行检验。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">13.   fget fputcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">是真正的函数࿰c;但是getc putc getchar putchar cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">都是定义的宏

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">14.   ungetccii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">的用法

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">15.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">未格式化的i/ocii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">操作

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">16.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">二进制数据避免了在数值转换为字符串过程中所涉及到的开销和精度损失࿰c;但是这些机巧只能将数据被另外一个数据顺序读取时才能使用。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">17.   fflushcii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">迫使一个输出流的缓存区内的数据进行物理写入࿰c;不管他是否已满。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">18.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">随机访问是通过读取和写入先前定位到文件中需要的位置来实现。

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">19.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">改变流缓存

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l5 level1 lfo9; tab-stops: list 18.0pt;">20.   cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">流错误函数࿰c;临时文件函数tmpfilecii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">࿰c;文件操纵函数

class="MsoNormal" style="margin: 0cm 0cm 0pt;">cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">第十六章cerun: yes;">  cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">标准库函数

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l6 level1 lfo10; tab-stops: list 18.0pt;">1.              cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">整型函数库:算术<stdlib.h>cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">取绝对值࿰c;除法运算(对整型的运算包含商和余数࿰c;返回一个结构)࿰c;随机数的<stdlib.h>cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">其中有个小技巧:使用每一天的时间作为随机数产生的种子cerun: yes;">  cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">;字符串转换<stdlib.h>cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">将字符串转换为数值

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l6 level1 lfo10; tab-stops: list 18.0pt;">2.              cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">浮点型函数库࿰c;<math.h>cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">包含了剩余数学函数的声明࿰c;这些函数的绝大多数返回值都是doublecii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">型,cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">注意区别定义域错误和范围错误;包含三角函数࿰c;双曲函数࿰c;对数和指数函数࿰c;浮点形式࿰c;幂函数࿰c;底数࿰c;顶数࿰c;绝对值和余数<math.h>cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">转换为doublecii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">型的字符串转换函数࿰c;(书上标记的是在<stdlib.h>cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">中࿰c;本人认为是笔误应该在<math.h>cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">中)

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l6 level1 lfo10; tab-stops: list 18.0pt;">3.              cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">日期和时间函数:<time.h>cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">处理器时间࿰c;当天时间其中有一个difftimecii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">函数用来计算两个时间的差值

class="MsoNormal" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt; mso-list: l6 level1 lfo10; tab-stops: list 18.0pt;">4.              cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">非本地跳转<setjmp.h>

class="MsoNormal" style="margin: 0cm 0cm 0pt;">5. cii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman';">信号

cle>

http://www.niftyadmin.cn/n/873607.html

相关文章

java中c标签for_c:forEach, c:forTokens 标签

, 标签这些标签封装了Java中的for&#xff0c;while&#xff0c;do-while循环。相比而言&#xff0c;标签是更加通用的标签&#xff0c;因为它迭代一个集合中的对象。标签通过指定分隔符将字符串分隔为一个数组然后迭代它们。forEach 语法格式items""begin"&quo…

eclipse 设置相同内容的背景色

Window->Preferences->General->Editors->Text Editors-> 注释-> Occurrences Annotations处&#xff1a;修改背景色[img]http://fhqllt.iteye.com/upload/attachment/136691/cb782d0f-eb0b-33c6-8dc4-3e11ee430a64.bmp[/img]

时间加减计算器_请问老师:如何利用GRE玩具计算器求余数?

请问老师&#xff01;如何利用GRE玩具计算器求余数&#xff1f;看这个方法GRE数学的计算器就是个玩具计算器&#xff0c;除了加减乘除最高级的功能是开根号&#xff0c;但是在考试的时候我们经常需要计算余数&#xff0c;不会用计算器快速算余数会浪费很多时间。举个例子&#…

qc中的流程图怎么画_超级详细的QC七大工具绘制方法,手把手教你做出漂亮图表...

原标题&#xff1a;超级详细的QC七大工具绘制方法&#xff0c;手把手教你做出漂亮图表QC七大工具很多质量人都知道&#xff0c;但是如何绘制这些图&#xff0c;有什么要求&#xff1f;今天我们为你带来干货&#xff0c;希望对你有帮助……一、特性要因图1、何为特性要因图1953年…

python杨辉三角形教程_Python实现杨辉三角算法

在Python中&#xff0c;杨辉三角总是拿出来当算法题考&#xff0c;那什么是杨辉三角呢&#xff1f;查看定义先来观察下面的杨辉三角图例&#xff1a;通过观察会发现&#xff0c;杨辉三角的每行的第一个与最后一个数都是1&#xff0c;且从第3行开始非1数字是它左上方和右上方的数…

eclipse 内容显示不全

不小心&#xff0c;勿点了Eclipse工具栏的一个属性&#xff1a; Show Source of Selected Element Only。 导致内容显示不全。 [img]http://fhqllt.iteye.com/upload/attachment/136776/b75ca422-893a-3e7b-8e58-f61535f98bf5.bmp[/img]

为什么刹车热了会失灵_刹车没毛病,为什么还要换刹车油?

刹车油也叫制动液或迫力液&#xff0c;全车油液中最容易变质的就是刹车油了。因为刹车油有很强的吸水性&#xff0c;吸水后的刹车油容易变质&#xff0c;沸点降低&#xff0c;直接影响刹车效果。湛江金富上汽大众但是很多老司机说没换刹车油&#xff0c;刹车一直都没什么问题&a…

greenmail java_java – 在不安装SMTP服务器的情况下测试Greenmail

我正在尝试使用Greenmail来测试我的localhost上的电子邮件功能.问题是我没有安装SMTP服务器,并且认为安装一个SMTP服务器过度.我的期望是应该有一个免费的库,允许我保持我的发送邮件代码相同,但不是真正发送电子邮件到SMTP服务器,发送到我的本地机器,以便我可以检索它们(为了单…