What error in my merge program
hello @Aditya-Kushwaha-914550392281281
a) u can do cin>>head or cout << head only after overloading >> and << operator.
u have not done this overloding so use buildlist function only.
b)
both the statement should be
c->next=mergesort(a->next,b);
c->next=mergesort(a,b->next);
i did not understand your point a
cin>>something works only for primitive datatype like int,string,char etc.
here in ur code
head is a pointer of custom class ,and cin object dont know how to read such custom object therefore it is showing error.
so we can do two things.
a) either we overload our operator >> (i.e we teach cin how to read such custom object).
or
b) we use function to take linked list as input.
if it is still not clear then pls watch linked list playlist again
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
will u plzz elaborate when we are doing c=a and c=b then the whole linked addres copies or the particulatr node