Question: I got the following code from internet:

```
struct {
   int x;
   struct {
       int y, z;
   } nested;
} i = { .nested.y = 5, 6, .x = 1, 2 };

```

The result is:

```
i.nested.y = 2
i.nested.z = 6

```

But I don't know why,the article from the net doesn't give any explanation.

Answer: 
Ok, first of all let me say that this is a terrible way to initialize a struct, and if it's a homework question - it's not a very good one either.
However, given the problem at hand, what I believe is happening in the initialization is this: first, y is initialized to 5, and z, being the next member in the struct, is initialized to 6. Then, x is initialized to 1 and the next member in the struct, in this case y, is initialized to 2 (which overwrites the 5).

Something important to note as well, is that the nested struct isn't a union, but a struct - first of all, because that's what the code says, but also because if it were a union - it would be impossible in this case for y and z to have different values, since both would be kept in the same location in the memory. : **As answered by Eran Zimmerman on the link provided by Grijesh Chauhan**
No idea how I mis-read this first, thanks to Jens for pointing this out.

It's simply initializing successive elements "as always", but the designator is used to change the current element first to `.nested.y`, which is initialized to `5` and then the succeeding element `.nested.z` gets the `6`, and so on. The final `2` then overwrites `.nested.y`.

This is rather obfuscated code, since the number of initializers is larger than the number of `int` fields in the struct, something "fishy" (aka "clever") is going on.