hey so this is my code for linear search. is there a problem with this?. coz its not comparing and returning if i enter an element which does not exist in the array
#include<stdio.h>
#include<conio.h>
int main()
{
int A[10]={2,3,4,5,6,7,8,9,1,20};
int n,item,counter=1,i;
printf("\nEnter the size of the array");
scanf("%d",&n);
printf("\nThe array size is A[%d]",n);
printf("\nEnter the number you would like to search in the array");
scanf("%d",&item);
A[n+1]=item;
for(i=0;i<n;i++)
{
if(A[counter]==item)
{
printf("\nItem found in the array!!");
}
counter++;
}
while(A[counter]!=item)
{
printf("\nItem not found in the list");
counter++;
};
getch();
return 0;
}