In the previous article, we introduced the establishment, traversal, insertion and deletion of linked lists. One problem is that when inserting, the second parameter is a ListNode* node, so how do we initialize a separate linked list when calling For nodes, the answer is to define an initialization function
struct ListNode { int num; ListNode* next; ListNode(int n = 0, ListNode *p = NULL) { num = n; next = p;} };
Default parameters are 0 and NULL
If you see other methods, I will continue to add them, and welcome to leave a message