Code:
void sort_list(STUDENT* stud)
{
STUDENT* first;
STUDENT* second;
STUDENT temp_student;
first = stud;
while( first != NULL )
{
second = first -> studentPtr ;
while( second != NULL )
{
if ( (first -> ID) < (second -> ID) )
{
temp_student.ID = first->ID;
strcpy(temp_student.name,first->name);
first->ID = second->ID;
strcpy(first->name, seconed->name);
second->ID=temp_student.ID;
strcpy(second->name,temp_student.name);
strcpy(temp_student.name,"");
temp_student.ID = 0;
}
second = second -> studentPtr;
}
first = first -> studentPtr;
}
}