Since your list is sorted, it should know on the first match that -1 isn't in the list, since the first element is the lowest.Expected result
Searching for -1 in numbers using linear search
Number not found after 16 steps
You never increment 'steps'. You never supply arguments for your specifiers for printf. Also, you apparently completely ignore your compiler as it screams at you for doing so...Code:if (value == numbers[i]) { printf("Number found after %d steps\n"); return; } printf("Number not found after %d steps\n");
Quzah.