scanf("%d", &n); for( i = 0; i < n; i++ ) scanf("%d", &a[i]); scanf("%d", &x); index = search( a, n, x ); if( index != -1 ) printf("index = %d\n", index); else printf("Not found\n");
intsearch( intlist[], int n, int x ); #define MAXN 10
intmain() { int i, index, n, x; int a[MAXN];
scanf("%d", &n); for( i = 0; i < n; i++ ) scanf("%d", &a[i]); scanf("%d", &x); index = search( a, n, x ); if( index != -1 ) printf("index = %d\n", index); else printf("Not found\n");
return0; }
intsearch( intlist[], int n, int x ){ int i,*p=&list[0]; for(i=0;i<n;i++){ if(x==*p++){ break; } } if(i==n){ return-1; } return i; }