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

3.(1010) 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[2]= 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]={1,2,3,4,5,6};
int y =3, z =4;
cout << x[y % z]<< endl; // line (a)
a(x, y);
cout << x[0]<< y << endl; // line (b)
b(x, z);
cout << x[2]<< z << endl; // line (c)
c(x,4); cout << endl; // line (d)
for (int i =0; i <4; 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!