Home / Questions / What is wrong with my sorting function?

What is wrong with my sorting function?

What is wrong with my sorting function? head is a global variable 

void medianscore(){

struct student *sort=head,*temp,*sort1=head;
struct student *k=head;
struct student *la=head;
while(sort!=NULL){
        while(la!=NULL){
        printf("While loopn");
        if(sort->grade>la->grade){
               temp=sort->next;
               la->next=sort->next->next;
               sort=temp;
}
      else{
               sort=sort->next;
               la=la->next;
}
}
}


struct student *j=head;
while(j!=NULL){
printf("First name: %5s %2d, Last name: %5s %2d, Score: %5.2f %2d, Zipcode: %5d %2dn",j->firstname,count,j->lastname,count,j->grade,count,j->zip,count);
j=j->next;
}
}

Nov 07 2017 Read more Less More

Answer (UnSolved)

question Subscribe To Get Solution

Recent Questions

Chat Now

Welcome to Live Chat

Welcome to MyCourseHelp Services, World's leading Academic solutions provider with Millions of Happy Students.

Please fill in the form