Skip to the task
Layout
Back to classic view

You are looking at: Practice test 1. Your place is still lesson 1, task 1: Algorithm.

CHECKTask 12 of 17 · step 3: Questions 7–12

Reverse the array?

What does it print?

int m[4] = {4, 3, 2, 1};
for (int x = 0; x < 4; x++) {
    m[x] = m[3 - x];
}
printf("%d %d %d %d\n", m[0], m[1], m[2], m[3]);
Stuck?

1 2 2 1: the second half reads boxes that were already overwritten. To reverse, swap pairs up to the middle. (Topic 6)