I think 99 is a result that shows that the higher bits are not intialized .. am I right? ..
That's right, because you just assign two bytes explicitly in the second example, so two bytes of an integer remain uninitialized. In the first example, you assign 4 to i , which is an integer and is divided by byte with c . However, if both members of the union are of the same type, it is assumed that both of them will be initialized correctly. In addition, the space allocated for combining is the space occupied by its largest member, so assuming that some of the bytes i will change when you assign c[x] will not be an error.
The different values ββthat you can see for uninitialized bytes with different initialization methods do not matter in different areas and contexts, are case-specific and are not defined. However, I can not comment on 515, because I do not understand how you get this value.
source share