Next: Pointer Arith, Previous: Escaped Newlines, Up: C Extensions

### 6.22 Non-Lvalue Arrays May Have Subscripts

In ISO C99, arrays that are not lvalues still decay to pointers, and may be subscripted, although they may not be modified or used after the next sequence point and the unary ‘`&`’ operator may not be applied to them. As an extension, GCC allows such arrays to be subscripted in C90 mode, though otherwise they do not decay to pointers outside C99 mode. For example, this is valid in GNU C though not valid in C90:

         struct foo {int a[4];};

         struct foo f();

         bar (int index)
         {
           return f().a[index];
         }