Typedef struct {char name [20]; int age; float score;} Stu; # import <Foundation/Foundation. h> // void sortbyname (Stu * P, int count) {for (INT I = 0; I <count-1; I ++) {for (Int J = 0; j <count-1-I; j ++) {If (strcmp (p + J)-> name, (p + J + 1) -> name)> 0) {Stu temp = * (p + J); * (p + J) = * (p + J + 1 ); * (p + J + 1) = temp ;}}// age void sortbyage (Stu * P, int count) {for (INT I = 0; I <count-1; I ++) {for (Int J = 0; j <count-1-I; j ++) {If (p + J) -> age> (p + J + 1)-> Age) {Stu temp = * (p + J); * (p + J) = * (p + J + 1); * (p + J + 1) = temp ;}}// score void sortbyscore (Stu * P, int count) {for (INT I = 0; I <count-1; I ++) {for (Int J = 0; j <count-1-I; j ++) {If (p + J)-> score> (p + J + 1)-> score) {Stu temp = * (p + J); * (p + J) = * (p + J + 1); * (p + J + 1) = temp ;}}} void output (Stu * P, int count) {for (INT I = 0; I <count; I ++) {printf ("name = % s, age = % d, score = %. 2f \ n ", (p + I)-> name, (p + I)-> age, (p + I)-> score );}} typedef void (* Fun) (Stu * P, int count); void student (fun func, Stu * P, int count) {func (p, count );} int main (INT argc, const char * argv []) {Stu STU [5] ={{ "Zhang", 20,80 },{ "Wang }, {"Li", },{ "Zhao", },{ "Liu", 20,89 }}; Stu * P = NULL; P = Stu; student (output, p, 5); student (sortbyname, P, 5); student (output, P, 5); // output (p, 5); // sortbyname (p, 5); // output (p, 5); Return 0 ;}