Array assignment by index while declaration in c language

arrays, c, variable-assignment

Solution

This is GCC extension to C89, part of standard in C99, called 'Designated initializer'.

See http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Designated-Inits.html.

Problem

``` void fun () { int i; int a[]= { [0]=3, [1]=5 }; } ``` Does the above way of a[] array assignment is supported in c language. if yes which c version. i compiled above code with gcc it works fine. but i never saw this kind of assignment before.

Original source