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
Зареєструйся Зараз
або Підпишись на майбутні тести