Hi,
I kinda confuse to understand the code for my lab assignment
below:
#define NOT_FOUND -1;
#define MAX 100
struct student
{ int id;
char name[20];
float q1, q2, q3, exam;
};
struct student stuArr[MAX];
int main()
{
/*call search function here*/
}
int search(int studentID)
{
int i;
for (i=0, i <MAX; i++)
if (stuArr[i].id == ID)
return i;
return NOT_FOUND;
}
===============================
Does the FOR loop in search() function will run from 0 to 99 regardless even a student ID has found at index, say, 45 or
it returns immediately the index of array where a student ID match and terminate the search() function right away and
go back to main() where it get called?
Thank you in advance for help explaining.
Sunset