In this,dont we need to provide the condition when one ll ends the second one will copy automatically or what happens if one ll ends?
Please answer this?
Yes this is necessary condition
and also consider
when first list end means a==NULL
so we have written
if (a==NULL) return b;
similarly
if(b==NULL) return a;