#include "stdafx.h" #include using namespace std; // A is the array that contains n numbers // x is the number to search for in the array // n is the size of the array int find(const int A[], int x, int n) { for (int i = 0; i < n; i++) if (A[i] == x) { return 1; } return 0; } int main() { int A[10] = { 1, 2, 3 }; int B[100] = { 10, 20, 30 }; int wasThere; wasThere = find(A, 2, 10); wasThere = find(B, 220, 100); wasThere = find(B, 220, 13); // only look at the first 13 // 75 .. 97 wasThere = find(&B[75], 220, 98 - 75); return 0; }