[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.18 Non-Lvalue Arrays May Have Subscripts

Subscripting is allowed on arrays that are not lvalues, even though the unary `&' operator is not. (In ISO C99, both are allowed (though the array may not be used after the next sequence point), but this ISO C99 feature is not yet fully supported in GCC.) For example, this is valid in GNU C though not valid in C89:

 
struct foo {int a[4];};

struct foo f();

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



This document was generated by Vincent Chung on June, 26 2001 using texi2html