Didier Kryn <k...@in2p3.fr> writes: [...]
>> A multi-line version could look like this: >> >> while (c = *r) { >> ++r; >> if (c == '/') n = r; >> } >> > > It might be done with a for loop. eg: > > for ( ; *r ; ++r) if(*r=='/') n=r; > n++; [...] > The for loop is the best construct for a loop with an incremental > cursor. That's nicely exemplified by the fact that the code above does a redundant increment (or did a redundant increment would it work, the {} are missing) solely to work around the fact that the "for loop mechanics" of checking the condition before the loop body is executed and performing a "variable increment step" afterwards are ill-suited to this particular problem ... _______________________________________________ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng