Demonstrating generic find algorithm with an array
#include <iostream>
#include <cassert>
#include <algorithm> // for find
using namespace std;
int main()
{
char s[] = "C++ is a better C";
int len = strlen(s);
// Search for the first occurrence of the letter e:
const char* where = find(&s[0], &s[len], 'e');
cout << *where<< endl;
where = find(&s[0], &s[len], 'A');
cout << *where<< endl;
return 0;
}
/*
e
*/
Related examples in the same category