Skip to the task
Layout
Back to classic view

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

CHECKTask 5 of 17 · step 2: Questions 1–6

Swapping without pointers

void swap(int a, int b) swaps a and b. main: x = 1, y = 2, swap(x, y), printf x y. What does it print?

Stuck?

1 2: the function swaps copies. You need int *a, int *b and swap(&x, &y). (Topic 8)