Memory Diagram – Draw a memory diagram for thefollowing block of code. [10 points]
void myFunction(int * myPtr)
{
int* x = myPtr + 1;
x[2] = 10;
myPtr = new int[5];
for (int i = 0; i < 5;++i)
myPtr[i] = x[0] + i + 3;
//Draw state of memory here.
}
int main ()
{
int* data = new int[6];
data[0] = -2;
for (int i = 1; i < 6;i++)
data[i] = *(data + i – 1) +2;
*data = 10;
int* temp = data;
myFunction(data);
return 0;
}
(You can use Google Draw or some other application togenerate a nice-looking diagram. Copy and
PayPal Gateway not configured
PayPal Gateway not configured