Q867
What is the output of the following code? #include int search_num(int *arr, int num, int len) int i; for(i = 0; i < len; i++) if(arr[i] == num) return i; return -1; int main() int arr[5] =1,3,3,3,5,num=3,len = 5; int indx = search_num(arr,num,len); printf("Index of %d is %d",num,indx); return 0;
A.
Index of 3 is 0
B.
Index of 3 is 1
AnswerC.
Index of 3 is 2
D.
Index of 3 is 3
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board