Why isn't my C++ solution working? Keep getting error "Line 36: member access within null pointer of type 'struct ListNode' "


  • 0
    J
    This post is deleted!

  • 0
    J

    Never mind just fixed it! Instead of setting while loop to check if (head->next!=NULL) I just changed it to while(head!=NULL) and put the last if statement inside the while loop.


  • 0
    R

    Excuse me, may I ask that which line is Line#36 ?
    This error also occurs in my coding(the same problem) and I still don't know why ,so I cannot fix it.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.