Hey,
I'm writing a function that searches for an id in an array of a structure, for some reason it returns -1 everytime, so I was just hoping another set of eyes could help me clarify this.
int searchAr(student studentar [], int size, int searchid)
{
int i;
for(i = 0; i<(size-1); i++)
{
if (studentar[i].studentID == searchid)
{
return i;
}
else
{
return -1;
}
}
}