Q906
What does the following code do? #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,2,3,4,5,num=3,len = 5; int indx = search_num(arr,num,len); printf("Index of %d is %d",num,indx); return 0;
A.
Search and returns the index of all the occurrences of the number that is searched
B.
Search and returns the index of the first occurrence of the number that is searched
AnswerC.
Search and returns of the last occurrence of the number that is searched
D.
Returns the searched element from the given array
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board