Arrays used as operand of operatiors except for sizeof
and unary &
are automatically converted to a pointer that points at the first element of the array.
The converted pointer is not a lvalue, so it cannot be used as the left operand of assignment operator.
This code works.
#include <stdio.h>
int main(void)
{
int a[5];
int i;
for (i=0; i<5; i++)
a[i] = i;
for (i=0; i<5; i++)
printf("a[%d] = %d\n", i, a[i]);
return 0;
}