size_t i = 0;
union a u;
for (i = 0; i < sizeof(int); ++i)
if (i == 0)
u.ch[i] = 1;
u.ch[i] = 0;
printf("%d %d %d\n",u.ch,u.ch,u.i);
I understand. The byte 3 and byte 4 are not zeros as I assumed, they must be garbage. I assumed they would be all zeros because of the rule "if you initialize one member of a structure, others are initialized to 0 automatically". I thought this applied to unions also.
I am working creating a fully encapsulated, homogeneous singly linked data structure. The Listing class and SinglyLinkedList class that are part of the whole application compile fine, but the problem ...