Question: 1.(i)For the following code, draw the diagram (follow the example in the book Display 9.3) to illustrate variables and pointers after the statements marked with

1.(i)For the following code, draw the diagram (follow the example in the book Display 9.3) to illustrate variables and pointers after the statements marked with numbers. (ii) And if we run this program, what is the output?

1.(i)For the following code, draw the diagram (follow the example in the 1)

int main()

{

int arr[] = { 10, 2, 6, 7 }; // (1)

int* p = (arr + 1); // (2)

cout

return 0;

}

2)

void product(int a, int &b, int c)

{

a = b * c; // (3)

b = a * c; // (4)

c = a * b; // (5)

}

int main()

{

int x = 2, y =3; // (1)

product(x, y, y); // (2)

cout

return 0;

}

DISPLAY 9.3 Explanation of Display 9.2 int *pl, *p2, pl? *p2-53; pl 53 p2 pl p1 new int; pl 53 *p1 = 42 ; p2 pl 42 tpl = 88; pl 53 p2 pl 42 p2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!