Question: 4 . ( 1 0 1 8 ) What's the output of the following code at each posi on . void a ( int x

4.(1018) What's the output of the following code at each posi on.
void a(int x[], int y){
x[0]= y;
y = x[1];
}
void b(int x[], int &y){
x[0]= y;
y = x[3];
}
void c(int x[], int y){
if (y <2) return;
cout << x[y -1];
c(x, y/2);
}
int main(){
int x[6]={3,4,5,6,7,8};
int y =3, z =4;
cout << x[y]% x[z]<< endl; // line (a)
a(x, y);
cout << x[0]<< y << endl; // line (b)
b(x, x[2]);
cout << x[2]<< x[0]<< endl; // line (c)
c(x,6); cout << endl; // line (d)
for (int i =0; i <5; i++) c(x, i); cout << endl; // line (e)
}

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!