25 lines
616 B
C

#include "./lib.h"
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Enter size of array: ");
int arr_size = -1;
scanf("%d", &arr_size);
int arr[arr_size];
printf("Enter elements:\n");
for (int i = 0; i < arr_size; i++) {
scanf("%d", &arr[i]);
}
int m = 0;
printf("Enter search element: ");
scanf("%d", &m);
bubble_sort(arr, arr_size);
printf("Sorted elements to search in: ");
for (int i = 0; i < arr_size; i++) {
printf("%d ", arr[i]);
}
printf("\n");
int location = binary_search(arr, m, arr_size);
printf("Location of %d was found at %d\n", m, location);
}