#include<iostream> using namespace std; template<class PTR, class DATA> PTR find(PTR start, PTR beyond , const DATA &x) { while(start != beyond && *start != x) ++start; return start; } int main() { int a[] = {1,2,3,4,5}; int *p = find<int*,int>(a,a+5,5); cout<<p<<endl; }