Alright, this is a really quick question: why does this first block of code compile, but the second one doesn't? They seem like they should be equivalent, since all that I change is the variable declaration/references.
First:
int memberStudents(struct studentType x, Snodeptr students, Snodeptr *s) {
Snodeptr p = *s;
while (p->next != NULL) {
if (strcmp(x.sid, p->student.sid) == 0)
return 1;
p = p->next;
}
return 0;
}
Second:
int memberStudents(struct studentType x, Snodeptr students, Snodeptr *s) {
while (s->next != NULL) {
if (strcmp(x.sid, s->student.sid) == 0)
return 1;
s = s->next;
}
return 0;
}
I want to change the Snodeptr s so that it points to the proper place, but when I try the second block of code I get an error saying there is a request for member 'next' in something not a struct or union.