Linked list is a basic lesson in C, but it's fun to implement them.

Define the structure

constructor

Why write this, because each manual malloc will be redundant, borrowed from the C++ new
Classic interview question, the difference between new and malloc
but cpp suggests using unique_ptr instead of bare pointers
About malloc without type conversion
 

Constructing a linked table

Print the linked table

nth

join_list

Insert node after

for example

delete nth node

it has boundary problem, use empty node to solve it.

free

main

valgrind test ok

 
Loading...
Steven Lynn
Steven Lynn
喂马、劈柴、周游世界
最新发布
我与 Dify 的半年
2025-3-9
我的2022年终小结
2024-11-9
记录雅思考试经历与一点学习心得
2024-11-9
Hackergame 2024 思路小结
2024-11-9
黑客松、日本、入职:我的2024下半年的总结
2024-11-9
NotionNext:基于Notion和NextJS的开源博客
2024-11-9