#include #include using namespace std; void f(int *first, int *last); int main() { int a[] {0, 10, 20, 30, 40, 50, 60, 70, 80, 90}; size_t n {size(a)}; //the number of elements in the array //The last element in the array is a[n-1], not a[n]. f(a, a + n); //a means &a[0]; a+n means &a[n] cout << "\n"; //Skip a line. f(begin(a), end(a)); //Easier way to do the same thing: don't need n. //begin(a) means &a[0]; end(a) means &a[n] return EXIT_SUCCESS; } void f(int *first, int *last) //Output all the elements from first to just before last { for (; first < last; ++first) { cout << *first << " "; } cout << "\n"; }