先把遇到的大部分错误写在前面
错误① runtime error: member access within null pointer of type 'ListNode' (solution.cpp)
![](https://i-blog.csdnimg.cn/blog_migrate/31594c88f473d8abfb9a1e6d6fdf33c7.png)
单链表的最后一个结点指向空,我们可以用最后一个结点->next,这个就是空,但不能用 最后一个结点->next->next,因为空已经不能再指向下一个结点,所以我们在调用->next的时候要保证不是结点不为空
错误②
![](https://i-blog.csdnimg.cn/blog_migrate/cddc6c9dc59622ff343cdaa84ed23756.png)
这种是heap-use-after-free堆释放后被使用 检查代码发现粗心的问题,想把指针置为空,结果写成了evenn->next==NULL; 应该是evenn->next=NULL;一个问题画图检查一晚上,结果错在这
错误③
use of undeclared identifier 'sun'; did you mean 'snn'?