#include <stdio.h>
void f (int Y[10] , int x) {
int j, k;
int i= 0; j = 9;
do {
k = (i+ j) / 2;
if( Y[k] < x)
i = k;
else
j = k;
} while ((Y[k] != x) && (i < j));
if(Y[k] == x)
printf(" x is in the array "); else
printf(" x is not in the array "); }
int main(void) {
int *Y;
int B[]={1,3,5,7,9,11,13,15,17,19};
Y = B;
f(Y,0);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGYgKGludCBZWzEwXSAsIGludCB4KSB7CiAgICBpbnQgaiwgazsKICAgIGludCBpPSAwOyBqID0gOTsKICAgIGRvIHsKICAgICAgICBrID0gKGkrIGopIC8gMjsKICAgICAgICBpZiggWVtrXSA8IHgpIAogICAgICAgIAlpID0gazsKICAgICAgICBlbHNlIAogICAgICAgIAlqID0gazsKICAgIH0gd2hpbGUgKChZW2tdICE9IHgpICYmIChpIDwgaikpOwogICAgaWYoWVtrXSA9PSB4KSAKICAgIAlwcmludGYoIiB4IGlzIGluIHRoZSBhcnJheSAiKTsKICAgIGVsc2UgCiAgICAJcHJpbnRmKCIgeCBpcyBub3QgaW4gdGhlIGFycmF5ICIpOwp9CgppbnQgbWFpbih2b2lkKSB7CglpbnQgKlk7CglpbnQgQltdPXsxLDMsNSw3LDksMTEsMTMsMTUsMTcsMTl9OwoJWSA9IEI7CglmKFksMCk7CglyZXR1cm4gMDsKfQ==