#include /* return the index of number x in array a or -1 if not found */ int search(int x, int size, int *a) { int i; for (i = 0; i < size; i++) if (a[i] == x) return i; return -1; } int main() { int i, a[10], x; for (i = 0; i < 10; i++) scanf("%d", &a[i]); while (printf("Search for: "), scanf("%d", &x) == 1) printf("search for %d yields %d\n", x, search(x, 10, a)); return 0; }