Question: What is the output of the following code? #include using namespace std; void foo ( int * &c , int * d ) { *

What is the output of the following code?
#include
using namespace std;
void foo (int* &c, int* d)
{
*(c+2)=10;
int *p = d;
*p =7;
d = c;
*d =*c +*(c-1);
c++; // :)
*c =0;
}
int main()
{
int a[5]={1,2,3,4,5};
int *p = &a[1];
int *q = new int;
*q =*(a+4);
cout <<*p <<""<<*q <<"
";
foo (p,q);
cout <<*p <<""<<*q <<"
";
for (int i=0; i <5; i++) cout << a[i]<<"";
}
Group of answer choices
1307
210
25
152
307
01025
15107
010
25
25
07
130105

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!