摘要: C标准函数库中,常见的堆上内存管理函数有malloc(), calloc(), recalloc(), free(), memset。 之所以使用堆,是因为栈只能用来保存临时变量、局部变量和函数参数。在函数返回时,自动释放所占用的存储空间。而堆上的内存空间不会自动释放,直到调用free()函数,才会 阅读全文
posted @ 2022-02-23 15:38 方诚 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 创建列表 typedef struct node{ void *val; struct node *next; struct node *prev; } node; typedef struct list{ int size; node *front; node *back; } list; voi 阅读全文
posted @ 2022-02-23 14:09 方诚 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 直接引用 在一个cpp文件中调用另外一个cpp文件, main.cpp与ctool.cpp在同一目录下 main.cpp #include <iostream> #include "ctool.cpp" int main(int argc, char* argv[]){ say_hello(); r 阅读全文
posted @ 2022-02-23 13:42 方诚 阅读(383) 评论(0) 推荐(0) 编辑