M
Q. What will be the output of the following code snippet?
#include <stdio.h> int search(int l, int r, int target, int a[]) { int mid = (l + r) / 2; if(a[mid] == target) { return mid; } else if(a[mid] < target) { return search(mid + 1, r, target, a); } else { return search(0, mid - 1, target, a); } } void solve() { int a[] = {1, 2, 3, 4, 5}; printf("%d", search(0, 5, 3, a)); } int main() { solve(); return 0; }
No solution found for this question.
Add Solution and get +2 points.
You must be Logged in to update hint/solution
Be the first to start discuss.
Q. Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?
Q. Which gcc flag is used to generate maximum debug information?
Q. What will be the output of the following C code?
Q. A binary tree with 27 nodes has _______ null branches.
Q. Types of Real numbers in C are.?
Q. What is the output of C Program with functions.?
Q. What is the default return type if it is not specified in function definition?
Discusssion
Login to discuss.