Question: After executing the following program segment, what is the value of the variables and output of the program? struct Play {int score, bonus;}; union value
After executing the following program segment, what is the value of the variables and output of the program?
struct Play {int score, bonus;};
union value {int p, q;};
enum level {easy, medium, hard};
Play player1 = {10, 15}, player2, player3;
value val; level game = medium;
++player1.score;
player2 = player1;
player2.bonus += 5;
player3 = player2;
player2.score += 12; player3.score += (int)game;
val.p = player1.score;
val.q = player1.bonus - 2; cout << game + 1;
cout << val.p << " " << val.q;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
