Making find work with built-in arrays
template <class T>
bool find(T* tp, int n, const T& x)
{
while (n > 0) {
if (*tp++ == x)
return true;
--n;
}
return false;
}
Where do we assume tp is a pointer?
Previous slide
Next slide
Back to first slide
View graphic version