Reputation: 23
i found the linked code and found this for loop which is a bit strange for me. i would appreciate if someone could explain me the syntax of this loop to me. MFG
void patch(Ptrlist *l, State *s)
{
Ptrlist *next;
for(; l; l=next){
next = l->next;
l->s = s;
}
}
Upvotes: 1
Views: 116
Reputation: 311126
This for loop
for(; l; l=next){
is equivalent to
for(; l != NULL; l=next){
or
for(; l != 0; l=next){
That is the for loop is executed until the controlling expression is equal to 0.
Upvotes: 1