#include #include int compare_int(int *pi1, int *pi2) { return *pi1 - *pi2; } int main(int argc, char * argv[]) { int t[] = {6, 2, 8, 6, 4, 8, 2, 9, 2, 1}; int x = atoi(argv[1]); qsort(t, 10, sizeof(int), (int (*)(const void *, const void *))compare_int); int * valeur = bsearch(&x, t, 10, sizeof(int), (int (*)(const void *, const void *))compare_int); printf("%s\n", (valeur == NULL) ? "non" : "oui"); return EXIT_SUCCESS; }