C++ Interview Questions

Bjarne-stroustrup
 
Prev9 of 17Next

According to the C++11 standard, what is the output of this program?

#include <iostream>

int f(int &a, int &b) {
	a = 3;
	b = 4;
	return a + b;
}

int main() {
	int a = 1;
	int b = 2;
	int c = f(a, a);
	std::cout << a << b << c;
}

Answer