#include <stdio.h> #define SIZE 15 void binarySearch(int numbers[], int value); void linearSearch(int numbers[], int value); int main() { int numbers[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1$ printf("Searching for -1 in numbers using linear search\n"); linearSearch(numbers, -1); printf("Searching for -1 in numbers using binary search\n"); binarySearch(numbers, -1); printf("\nSearching for 0 in numbers using linear search\n"); linearSearch(numbers, 0); printf("Searching for 0 in numbers using binary search\n"); binarySearch(numbers, 0); printf("\nSearching for 7 in numbers using linear search\n"); linearSearch(numbers, 7); printf("Searching for 7 in numbers using binary search\n"); binarySearch(numbers, 7); printf("\nSearching for 11 in numbers using linear search\n"); linearSearch(numbers, 11); printf("Searching for 11 in numbers using binary search\n"); binarySearch(numbers, 11); printf("\nSearching for 15 in numbers using linear search\n"); linearSearch(numbers, 15); printf("Searching for 15 in numbers using binary search\n"); binarySearch(numbers, 15); printf("\nSearching for 22 in numbers using linear search\n"); linearSearch(numbers, 22); printf("Searching for 22 in numbers using binary search\n"); binarySearch(numbers, 22); return 0; } void linearSearch(int numbers[], int value) { /* Use linear search to find value in numbers. Print the number of steps it takes to find or not find value */ for (int i=0; i < SIZE; i++) { if (value == SIZE[i]) { return i; } else return -1; } }

I am trying to create a linear search in C as a part of some homework for school but I can't seem to work it out. I have tried to do it (See code) but yeah it doesn't work. Any help would be great. Thanks