(head1 != NULL && head2 != NULL) head1,head2都是空指针 为什么是false
时间: 2024-05-27 18:10:52 浏览: 57
空指针异常
&& head1->data < head2->data) {
This code checks two conditions:
1. If head1 is not NULL: This ensures that head1 exists and is not a null pointer. If head1 is NULL, then head1->data will result in a segmentation fault.
2. If head1's data is less than head2's data: This checks if the data in head1 is less than the data in head2. If this condition is true, then we know that head1 should come before head2 in the merged linked list. If this condition is false, then we know that head2 should come before head1 in the merged linked list.
阅读全文