You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
214 B
27 lines
214 B
2 months ago
|
|
||
|
struct CmdA {
|
||
|
int a, b;
|
||
|
}
|
||
|
|
||
|
struct CmdB {
|
||
|
float a, b;
|
||
|
}
|
||
|
|
||
|
union AnyCmd {
|
||
|
CmdA a;
|
||
|
CmdB b;
|
||
|
}
|
||
|
|
||
|
struct Cmd {
|
||
|
int type;
|
||
|
AnyCmd cmd;
|
||
|
}
|
||
|
|
||
|
fn int main()
|
||
|
{
|
||
|
Cmd c;
|
||
|
c.type = 1;
|
||
|
c.cmd.a = {.a = 1, .b = 2};
|
||
|
return 0;
|
||
|
}
|