qsort进行排序的数组存储的不能是结构体的指针,需要是结构体本身。 结构体 struct student{ char* id; int mark; }arr[4], test0={ "0001",80}, test1={ "0002",90}, test2={ "0003",60}, test3={ "0004",61} ; 排序函数 int cmp(const void *a, const void *