LeetCode203错误分析:
(3条消息) LeetCode:runtime error: member access within null pointer of type 'struct ListNode'错误_时间有泪-CSDN博客
如上述博客方法进行更改后执行错误,最后的更改方式:
if(p==NULL){
   return head;
}
while(p->next!=NULL){
     if(p->next->val==val){
        q=p->next;
        p->next=q->next; 
        delete q;
     }
     else{
        p=p->next;
     }
} 
期望的改正方式:但改正后依旧如题目报错
while(p->next!=NULL&&p!=NULL){
     if(p->next->val==val){
        q=p->next;
        p->next=q->next; 
        delete q;
     }
     else{
        p=p->next;
     }
}








