What is the output of following function, if called as foo( rr,0,6) ? arr content as follows: a-b-c- d-e-f
void foo(char arr[], int i, int s)
{
if(i>=s) return ;
cout<< arr[i];
if * (i + 1 < s)
foo(arr, i+2,s) ;
cout<<arr [ i]; }
Select one :
a. a c e a c e
b. a c e e c a
c. a c b e e a
d. a d f f d a
Answer:
b. a c e e c a
Comments
Leave a comment