Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The question is what prints out of this code, reason for those 4 boxes on the si

ID: 673741 • Letter: T

Question

The question is what prints out of this code, reason for those 4 boxes on the side. Now there is an error from the professor on this code, the last line where it returns "soccer", its supposed to be a capitalized "Soccer". Because lowercase would cause that to be an error. So ignore that, if that error was't there, what would this program print out, and why and how? thanks !

include struet Mystery int foo struct Mystery bar struet Myatery Baseball (struet Myaterycap, Int uns) struct Mysteryunner malloe(alzeof (struet Mystery)) runner-foo-runs runner-barNULL if(cap-_ NULL}{ return runner i else atruct Mystery atbat-capi while(cap , bar !-NULL) cap cap->bar cap).barunner: return atbat int Soccer (struct Mystery shoe, int goal) LE (goal-0) return shoe->foo: return Soccer (shoe->bar,goal-1) struet Mystery IceHockey (struet Mysterypuck) (puek!-NULL) struct Mystery goalie puck-bar Eree (puck) return goalie return NULL int main) struct Mysteryteams NULL eams-Baseball(teams, 3) eams-Baseball(teams, 2) teamsIceHockey (teams) i eams- BaseBali (teams,1) eams- BaseBali (teams,0) teamsIceHockey (teams) i eams- BaseBali (teams,3) eams- BaseBali (teams, 2) printf ("%d ", soccer/ teams, 1)) ; printf ("%d ", soecer { teams,0)) ; teamsIceHockey (teams) i printf ("%d ", soccer { teams,2)) ; printf ("%d ", soecer { teams, 1)) ; teamsBaseball(teams,1) retur soccer (teams, 0)

Explanation / Answer

The reason for four boxes is : there are four structures as:

1) Mystery

2) Baseball

3) Scoccer

4) IceHockey

The output of the above program will be as follows:

The program is still giving error, except the error of Scocer

the error is in Baseball:

in the while loop...bar is not a structure or a union which is creating an error

otherwise it will display baseball runs of 12 and for Soccer, it will return team, coz at the end of the program we get goal==0

For Ice-Hockey it will return goalie.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote