pointers-memory · beginner · ~15 min
Iterate an array by moving a pointer.
Implement long sum_via_ptr(const int *a, int n) summing n elements by advancing a pointer (no indexing).
long sum_via_ptr(const int *a, int n) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.