I am trying to create a network application and I need to write one choice at a time, one, two or three. The union below writes 4 characters to the network, even if I used only struct one.
union choice_
{
struct one_
{
unsigned char one[2];
}src;
struct two_
{
unsigned char two[2];
}two;
struct three
{
unsigned char one[2];
unsigned char two[2];
}three;
}choice;
Can't I just write choice.one
I'm a little confused here, how can I build a selection of structures?
Dev bag
source
share