We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
After loop ends, there are two possibilities:
1) Either of the list reaches NULL so headA==headB returns false because one of them is pointing to valid memory address.
2) or Both points to NULL so headA==headB returns true, oth pointing to invalid address/memory.
Yes you can consider headA and headB pointing to same memory but NULL means "No memory".
Compare two linked lists
You are viewing a single comment's thread. Return to all comments →
After loop ends, there are two possibilities: 1) Either of the list reaches NULL so headA==headB returns false because one of them is pointing to valid memory address. 2) or Both points to NULL so headA==headB returns true, oth pointing to invalid address/memory.
Yes you can consider headA and headB pointing to same memory but NULL means "No memory".