Complete the code to declare a union named Data.
union [1] {
int i;
float f;
};The union is declared with the name Data as required.
Complete the code to create a variable named d of the union Data.
union Data d[1];In C++, variables are declared with a semicolon ; at the end.
Fix the error in assigning the integer 10 to the union variable d.
d.[1] = 10;
f instead of i.The union has an integer member named i. Assigning to d.i stores the integer 10.
Fill both blanks to declare a union named Value with a char and a double member.
union [1] { [2] c; double d; };
The union is named Value. It has a char member named c and a double member named d.
Fill all three blanks to create a union named Data with an int member i, a float member f, and assign 3.14 to f.
union [1] { int [2]; float f; }; [1] d; d.[3] = 3.14f;
The union is named Data. It has an int member i and a float member f. The variable d is of type Data. The assignment d.f = 3.14f; sets the float member.