Question: race the following code that modifies the array. The write the modified array in the space provided. 1 #include 2 using namespace std; 3 4

race the following code that modifies the array. The write the modified array in the
space provided.
1 #include
2 using namespace std;
3
4 int main()
5{
6 int values ={1,2,3,5,7,9};
7 int* p = values;
8 int* q = values +3;
9 while (p < q)
10{
11 int temp =*p;
12*p =*q;
13*q = temp;
14 p++;
15 q--;
16}
17}
To trace the code, first fill in the
initial values of p and q as indices.
After that the loop starts.
p q temp *p *q
Answer: values[]=

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 Programming Questions!