#include <iostream>
#include <cassert>
#include <algorithm>
#include <list>
#include <iterator>
using namespace std;
int main()
{
int a[10] = {12, 3, 25, 7, 11, 213, 7, 123, 29, -31};
// Find the first element equal to 7 in the array:
int* ptr = find(&a[0], &a[10], 7);
assert (*ptr == 7 && *(ptr+1) == 11);
cout << *ptr;
return 0;
}
|