Skip to content
Quiz · References and Pointers · lesson 3 of 9

Quiz — reference or pointer

What does the program print?

C++
#include <iostream>

int main() {
    int a = 1;
    int b = 2;
    int& r = a;
    int* p = &a;
    r = b;
    p = &b;
    *p = 3;
    std::cout << a << ' ' << b << '\n';
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way