Linear Search in C

Here you will find program for linear search in C.

Linear search is the simplest searching algorithm which is sometimes known as sequential search. In this algorithm each element of array is compared with the targeted element sequentially.

Linear Search in C

 

Output 

How many elements?4
Enter array elements:
6 8 9 1

Enter element to search:9
Element found at index 2

4 thoughts on “Linear Search in C”

    1. If desired element is not found then all the elements in the array would be traversed so in that case value of i would not be less than n.

Leave a Comment

Your email address will not be published. Required fields are marked *