文章标题

来源:互联网 发布:mahout java实例教程 编辑:程序博客网 时间:2024/04/24 01:21

C和指针 读书笔记

指针为什么重要

  1. 指针使得C语言威力无穷
    • C 语言实现更高效
    • 另一些任务其他语言根本无法实现,如直接访问硬件。
  2. 指针虽然强大,但稍有不慎就会blow your feet。

因此可以说,指针就是一把双刃剑, 使用得当,可以简化算法实现,但使用不当就会引起错误,出现令人费解的症状,而且极难发现。

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

Brian Kernighan

C语言的参数传递规则:所有传递给函数的参数都是按值传递的。
  1. 注意strcpy, strncpy,strlcpy的区别
0 0