Linear search is also called as sequential search. All the elements need not be in sorted order like binary search. The program for linear search is written in C language.

Check the other linear search articles given below

Linear Search in C

#include <stdio.h>
int main()
{
    int a[10], i, item,n;
    printf("\nEnter number of elements of an array:\n");
    scanf("%d",&n);
    printf("\nEnter elements: \n");
    for (i=0; i<n; i++)
        scanf("%d", &a[i]);
    printf("\nEnter item to search: ");
    scanf("%d", &item);
    for (i=0; i<=9; i++)
        if (item == a[i])
        {
            printf("\nItem found at location %d", i+1);
            break;
        }
    if (i > 9)
        printf("\nItem does not exist.");
    return 0;
}

Output for Linear Search in C:

Enter number of elements of an array:
8

Enter elements:
2 3 5 7 8 6 4 1

Enter item to search: 1

Item found at location 8