8. References

Question.7

A developer writes a swap function using C++ references instead of C-style pointers:

void swap(___ a, ___ b) {
   int temp = a;
   a = b;
   b = temp;
}

int x = 10, y = 20;
swap(x, y);
// x should be 20, y should be 10

What goes in the blanks?

Need Help? Refer to the Quick Guide below

Select Answer

Restart quiz!