That is quite dumb though. *(array_name + i) provides no advantage over array_name[i]. If you want to use pointer arithmetic, an appropriate use is with a generic algorithm, e.g.,
Another appropriate use, more likely what you are expected to do, would be to use a pointer to iterate, e.g.,Code:#include <numeric> // ... int sum = std::accumulate(array_name, array_name + 10, 0);
Code:int sum = 0; for (int* p = array_name; p != array_name + 10; ++p) { sum += *p; }