Google-protobuf: How to create unions using Google protocol buffer
In protobuf there is a dedicated structure for that (I'm using it in C++ though, not sure if it will work in pure C):
message MyUnion {
oneof MyUnionOneof {
bool booleanValue = 1;
string stringValue = 2;
}
}
Check out this link: https://developers.google.com/protocol-buffers/docs/proto#oneof