Ok, I'm learning Winsock, but there's this part I'm confused about, with a union in a struct (I know how it works but I don't know why it's done like that). This is what it looks like:
And the only member of in_addr is the union S_un. What would the point of this be? Wouldn't it be easier and simpler just to use the union without embedding it in a struct?Code:struct in_addr { union { struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; struct { u_short s_w1,s_w2; } S_un_w; u_long S_addr; } S_un; };