News for hackers. Stuff that matters.
Re:C uses "&" for the address-operator because 'ampersand so... by adrian_b on Tuesday October 10, 2023 @02:00PM (#37835316)
Your example would be "for i in o:N for j in o:M do".

Equivalent syntax was used in Fortran for writing cycles in a simpler way than in C already 20 years before C. ("do 10 i=0,N do 20 j=0,M")

The only case when the C "for" is useful is when the third operation is neither an addition nor a subtraction. The most frequent such case is when the operation is a link dereferencing, for accessing a linked list.

Such cases, for visiting all members of some non-array aggregate data, e.g. linked lists or trees, are solved more clearly with iterators.

There are no comments on this comment yet.