Program to Implement Linear Search in 1D array in C

Description


Linear Search is also known as sequential search.

Here the array of integers are entered in the array ‘arr[]’.
Variable ‘x’ is used to store the element to be search.
Then a funtion ‘linear_search()’ is called which keep on comparing each element of array with the element to search until the desired element is found or list ends.
If element is found then funtion returns its position to the main function otherwise it returns ‘-1′ indicating element not found.

SOURCE CODE
OUTPUT

Author Description

humanz

Our mission is to bring the affordable Technology education to people everywhere, in order to help them achieve their dreams and change the world. - Follow @program_guide

No comments yet.

Join the Conversation