上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要: 指针函数: int *fun(int x, int y); 首先是一个函数,返回一个指针。 函数指针: int (*fun)(int x , int y); 首先是一个指针,指向一个函数。 void add(void) { printf("shuchu \n"); } int main(int ar 阅读全文
posted @ 2023-04-19 11:37 jason8826 阅读(3) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct NODE{ int value; struct NODE *next; } Node; int createHeadNode(Node **headLo 阅读全文
posted @ 2023-04-13 22:52 jason8826 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 转载:https://www.cnblogs.com/yuxin2012/p/4714743.html 最近在读《重构——改善既有代码的设计》这本书,在 9.4 Remove Control Flag(移除控制标记)这一节,作者提到了“单一入口”和“单一出口”这两个原则,并对“单一出口”原则批驳了一 阅读全文
posted @ 2023-04-13 12:35 jason8826 阅读(80) 评论(0) 推荐(0) 编辑
摘要: #include有两种形式来指出要插入的文件 <>表示从系统目录下开始搜索,然后再搜索PATH环境变量所列出的目录,不搜索当前目录. "" 表示从当前目录开始搜索,然后是系统目录和PATH环境变量所列出的目录. 所以,系统头文件一般用<>,用户自己定义的则可以使用"",加快搜索速度. 标准头文件格式 阅读全文
posted @ 2023-04-11 15:36 jason8826 阅读(101) 评论(0) 推荐(0) 编辑
摘要: gcc常用指令 -E:预处理,生成test.i文件。 例:gcc -E test.c -o test.i(或gcc -E test.c) -S:main.i->main.s,生成汇编代码。 例:gcc -S test.i -o test.s -c:main.s->main.o,生成二进制目标文件。 阅读全文
posted @ 2023-04-11 15:29 jason8826 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 变量类型 作用域 生存周期 全局变量 全局 全局 本地变量 本地 本地 静态本地变量 本地 全局 static可以用作函数和变量的前缀。 对于函数,static的作用仅限于隐藏,其他文件(或函数外)无法访问; 对于变量,static还有下面两个作用: 1.保持变量内容的持久 2.默认初始化为0 注: 阅读全文
posted @ 2023-04-07 17:41 jason8826 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 一维数据做函数参数: 1.数组作为参数传给函数时,数组可以转换成一个指针,传入数组名相当于传入数组首个元素的地址,不是传整个的数组空间。 2.数组可以当做指针用,指针也可以当做数组用的例子 void main(int argc, char *argv[]) { char str[20] = "123 阅读全文
posted @ 2023-04-06 20:43 jason8826 阅读(44) 评论(0) 推荐(0) 编辑
摘要: size_t 概括地说,就是unsigned integer 跨平台的形式。size_t 常用在内存分配,类型拷贝类的函数。例如:memcpy, strlen, malloc等函数中; void *malloc(size_t n); void *memcpy(void *s1, void const 阅读全文
posted @ 2023-04-04 17:00 jason8826 阅读(32) 评论(0) 推荐(0) 编辑
摘要: main()函数参数通常我们在写主函数时都是void main()或int main() {..return 0;},但ANSI-C(美国国家标准协会,C的第一个标准ANSI发布)在C89/C99中main()函数主要形式为:(1)int main(void)(2)int main(int argc 阅读全文
posted @ 2023-04-02 10:00 jason8826 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 指针指向的是const(表示不能通过这个指针去修改变量,并不是使得那个变量成为const) const int *p = &i; // 等价 const int (*p) = &i; 和 int const (*p) = &i; i = 24; // ok *p = 25; // error p++ 阅读全文
posted @ 2023-03-27 20:44 jason8826 阅读(10) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 下一页