In C language, if initialize an array like this:
int a[5] = {1,2};
then all the elements of the array that are not initialized explicitly w
I try to give a short and simple answer for the puzzle: int a[5] = { a[2] = 1 };
a[2] = 1 is set. That means the array says: 0 0 1 0 0{ } brackets, which are used to initialize the array in order, it takes the first value (which is 1) and sets that to a[0]. It is as if int a[5] = { a[2] }; would remain, where we already got a[2] = 1. The resulting array is now: 1 0 1 0 0Another example: int a[6] = { a[3] = 1, a[4] = 2, a[5] = 3 }; - Even though the order is somewhat arbitrary, assuming it goes from left to right, it would go in these 6 steps:
0 0 0 1 0 0
1 0 0 1 0 0
1 0 0 1 2 0
1 2 0 1 2 0
1 2 0 1 2 3
1 2 3 1 2 3