Vidyalelo
Data Structure · Q486

Miscellaneous on Data Structures

Programming · Data Structure · question 486

Q486

What is the output of the following code? void my_recursive_function(int *arr, int val, int idx, int len) if(idx == len) printf("-1"); return ; if(arr[idx] == val) printf("%d",idx); return; my_recursive_function(arr,val,idx+1,len); int main() int array[10] = 7, 6, 4, 3, 2, 1, 9, 5, 0, 8; int value = 2; int len = 10; my_recursive_function(array, value, 0, len); return 0;

A.
3
B.
4
Answer
C.
5
D.
6

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board