Search an element in an array(linear search)

Search an element in an array(linear search)

Implementation:

#include <stdio.h>
#include <stdlib.h>

/* linear search function to search the element */
int search(int *a,int n,int s)
{
 int i;
 for(i=0;i<n;i++)
 {
  if(*(a+i)==s)
  {
   return 1;
   break;
  }
 }
 return 0;
}

int main(void) {
 int *a,i,n,s;
 a=(int*)malloc(sizeof(int)*100);
 scanf("%d",&n);
 for(i=0;i<n;i++)
 scanf("%d",(a+i));
 scanf("%d",&s); //element to search for
 //linear search
 if(search(a,n,s))
 printf("element found");
 else
 printf("element not found");
 return 0;
}