• + 1 comment

    First check (headA == NULL && headB == NULL) is not necessary because the following two will handle it.