What will be printed out as a result of the following programs execution?
#include <iostream>
using namespace std;

void print(int x, int y) {
    cout << x << y << endl;
}

int main() {
    int x = 1;
    int y = 2;
    print(y = 5, x = 6);
}
Explanation
There is no passing arguments by name in C++. y = 5 expression's value is 5, and x = 6 value is 6. Therefore, values ​​5 and 6 are passed to be printed out.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes