Default :
Source: https://www.hackerearth.com/practice/algorithms/searching/linear-search/tutorial/
code:
/* hackerearth linear search test */ #include<stdio.h> int main() { //long long int sizer=100000; //long long int A[sizer]; long long int A[100005]; int i,n,m; scanf("%d %d",&n,&m); for(i=0; i<n; i++) { scanf("%d",&A[i]); } int result=-1; for(i=0; i<n; i++) { if(A[i]==m) { result=i+1; } } printf("%d",result); return 0; }