Explanatory Question
Write C code to do Binary Search in an Array?
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.
#include #include void main() { int array[10]; int i, n, elem, found=0; clrscr(); printf("Enter the value of N\n"); scanf("%d",&n); printf("Enter the elements one by one\n"); for(i=0; i elem) u=mid-1; else l=mid+1; } mid=mid+1; if ( found == 1) printf("SUCCESSFUL SEARCH\n"); else printf("Search is FAILED\n"); } /* End of main */
First read the answer fully, then try to explain it in your own words. After that, open a few related questions and compare the concepts. This method helps you remember the topic for a longer time and improves exam preparation.