I know you can do this:
int a[5] = { 0, 3, 8, 0, 5 };
or
int a[5];
a[1] = 3;
a[2] = 8;
a[4] = 5;
Can you do the same in just one line, already in the definition?
I know you can do this:
int a[5] = { 0, 3, 8, 0, 5 };
or
int a[5];
a[1] = 3;
a[2] = 8;
a[4] = 5;
Can you do the same in just one line, already in the definition?
It has a syntax for this:
int a[5] = { [1] = 3, [2] = 8, [4] = 5 };
It can even be in any order. This syntax is the same as doing the assignment after the declaration.