Problem in one step

here is the link of my code


I tried to do this but was unable to incorporate all the case so i look to gfg where I found this code, how the step that I am commented is undertaking all the cases. Can someone explain me the detailed intution behind it.
code for this step is as follows :
while(temp->next!=NULL and temp->next->datadata){
temp = temp->next;
}
current->next = temp->next;
temp->next = current;

Hello @great you want me to explain the whole code or only the certain part?
please elaborate.

Hello Tushar, only the part highlighted in code mentioned in the question.
this part
while(temp->next!=NULL and temp->next->datadata){
temp = temp->next;
}
current->next = temp->next;
temp->next = current;

Hello @great in this step we are doing like first we have marked temp as mark that we have to sort the elements where temp is:
so in this:
if we found that element is greater then the element at temp then we will swap the two elements.
if you have any further doubt you can ask here:
Happy Learning!!

@great do you have any query?

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.