pointers-memory · beginner · ~15 min
Understand that a[n] is *(a + n).
Implement int nth(const int *a, int n) returning a[n] using pointer arithmetic (*(a + n)), not the indexing operator.
int nth(const int *a, int n) {
/* TODO: use *(a + n) */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.