basics · beginner · ~15 min
Swap from both ends toward the middle.
Implement void reverse_array(int *a, int n) reversing the first n elements in place using two indices.
void reverse_array(int *a, int n) {
/* TODO */
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.