/* return the index of student number x in array a or -1 if not found */ int search(int x, int nstudents, struct studentinfo *a) { int i; for (i = 0; i < nstudents; i++) if (a[i].number == x) return i; return -1; }