Guest User

Untitled

a guest
Apr 26th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.75 KB | None | 0 0
  1. if(ch==5)/*menu to sort list*/
  2.       {
  3.                node *t,q;
  4.                int i,j,n=0;
  5.                t=first;/*first node*/
  6.                while(t!=NULL)
  7.                {
  8.                              t=t->next;
  9.                              n++;
  10.                              }
  11.                
  12.                for(i=0; i<n; i++)
  13.                {
  14.                         for(j=0; j<n-i; i++)
  15.                         {
  16.                                  if(t->next!=NULL){
  17.                                  if((t->age)>((t->next)->age)){
  18.                                  q=*t;
  19.                                  *t=*(t->next);
  20.                                  *(t->next)=q;}
  21.                                  }
  22.                         }
  23.                }
Add Comment
Please, Sign In to add comment