1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课外】15.结构体1/6-5 结构体的最值.c

14 lines
259 B
C

ST* MaxST(ST d[], int n, int k) {
ST* res = NULL;
for (int i = 0; i < n; i++) {
if (d[i].gender == k) {
if (res == NULL || d[i].scored > res->scored) {
res = &d[i];
}
}
}
return res;
}