Q. Which of the following is the correct way to define a union in C++?

  • (A) union MyUnion { int x; float y; };
  • (B) struct MyUnion { int x; float y; };
  • (C) class MyUnion { int x; float y; };
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) union MyUnion { int x; float y; };
Explanation: The correct way to define a union is 'union MyUnion { int x; float y; };'.
Explanation by: Ram Sharma
The correct way to define a union is 'union MyUnion { int x; float y; };'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
147
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
89%
Success Rate