Question: int c = 75; int d = 100; int& r1 = c; int& r2 = d; c++; r2++; Use the code above. Suppose the variable

int c = 75;

int d = 100;

int& r1 = c;

int& r2 = d;

c++;

r2++;

Use the code above. Suppose the variable c lives at memory address 512, and d lives at the memory address 1024. The size of an integer is 4 bytes. After execution of the above code, draw labelled boxes for each of the 4 variables c, d, r1 and r2, and show their integer values. For r1 and r2, draw an additional arrow to where it points. Include addresses of boxes where applicable.

int w = 1;

int x = 2;

int* f = &w;

int* g = &x;

int y = 3;

int z = 4;

int& h = y;

int& i = z;

f = g;

h = i;

Draw labelled boxes for each of the 8 variables, and after execution of the above code show the contents of each box. Assume w lives at memory address 128, x lives at 256, y lives at 512, and z lives at 1024. In addition, draw arrows from f, g, h and i to where they point. Include addresses of boxes where applicable.

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!