W3cubDocs

/GCC 12

8.9.2 C99-Like Fast Enumeration Syntax

A c99-like declaration syntax is also allowed:

id array = …;

for (id object in array)
{
  /* Do something with 'object'  */
}

this is completely equivalent to:

id array = …;

{
  id object;
  for (object in array)
  {
    /* Do something with 'object'  */
  }
}

but can save some typing.

Note that the option -std=c99 is not required to allow this syntax in Objective-C.

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/c99-like-fast-enumeration-syntax.html