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: 
Non-designated initializers operate always on the next element in the structure. So the latest `2` operates on what comes after `.x`, which is `.nested.y`. In the same way the `6` goes for the `nested.z`.

If an initializer has several values for an element, the last in the list wins.

But if you have compiler that implements designated initializers, there should be no reason not to use them. The example that you are giving is very much far fetched and not of much educational value.
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**