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

#include <iostream> using namespacestd; int X(6),C(3); int TestMe(int &Y, intZ);

ID: 3612066 • Letter: #

Question

#include <iostream>

using namespacestd;

int X(6),C(3);

int TestMe(int &Y, intZ);

int main(void)

{

int A, B,W;

A = 5;

B = 2;

X = 1;

W = TestMe(A,B);

// Last two outputlines

cout << "A = "<< A << " B = " << B <<endl;

cout << "X= "<< X<< " C = " << C << endl;

return 0;

}

int TestMe (int &Y,int Z)

{

int C;

cout << " Y = "<< Y <<" Z = " << Z << endl;

cout << "C = "<< C << endl;

cout << " X = "<< X << endl;

C = 4;

Z = 7;

X = C + Z;

Y = X + Z;

cout << " X = "<< X <<" Z = " << Z << endl;

cout << " Y = "<< Y << endl;

return Z;

Explanation / Answer

please rate - thanks trace outputs in red X=6 C=3 A  =  5 B = 2 X changed to 1 W =TestME(A,2) in testMe get (address of A(Y) which has a 5 which can be change and Zwhich is 2 and cannot be changed) C=whatever is in the memory location assigned (garbage) output Y = 5 Z = 2 C = garbage X = 1 C changed to 4 Z changed to 7 X = 11 Y =18 X=11 Z=7 Y = 18 return 7 to main A was chaged to 18 in function B wasunchanged W=7 A = 18 B = 2 X = 11 C = 3 X = 11 C = 3