Question: What will the following code printout? void Function(int *ptr) { *ptr = 11; } // In Main... int values[] = {4, 10, 6, 12, 8,

What will the following code printout?

void Function(int *ptr)

{

*ptr = 11;

}

// In Main...

int values[] = {4, 10, 6, 12, 8, 14};

int *p = &values[4];

Function(p);

for(int i = 2; i < 5; i++)

cout << values[i] << ' ';

a) 6 12 8 14

b) 6 12 8

c) 4 10 6 11 8 14

d) 6 12 11

e) 6 12 11 14

I know the answer is D, but I do not know why! Can someone please explain it to me ! Thank you

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!