What will be printed out as a result of the following code execution?

#include <iostream>
using namespace std;

int main() {
    int a = 3;
    int b = 4;
    int c = 5;
    int &d = b;

    a = b = c;

    cout << a << b << c << d << endl;
    
    return 0;
}
Explanation
Assignment is performed from right to left -> a = b = c = 5 and d refers to b -> value of d coincides with the value of b.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты