I need to know how to change a property of each object in an array and sort that objects according to that property value. highest to lowest.
this is the program
typedef struct
{
char name[100];
int comp, math, phys, rank;
int total;
} student;
and created an array of students
student student1 ={"student1", 1, 1, 1, 0, 3}
student student ={"student2", 1, 2, 1, 0, 4}
student studentList[0] = student1;
student studentList[1] = student2;
now I have an array of students
how to change the "rank" of each object in the array, the highest total should has a rank of 1,
the code should be dynamic, means if the array length was 2 or 100, it doesn't matter
// change rank property of each object in a list
// print all students sorted by rank