Question PRG-CPP-0019
HardWhat is the output of this program?
#include <iostream>
using namespace std;
int main() {
int x = 10;
auto byVal = [=]() { return x; };
auto byRef = [&]() { return x; };
x = 11;
cout << byVal() << " " << byRef();
return 0;
}
- A.
10 11
- B.
11 10
- C.
Sign up free to see the answer and a step-by-step explanation.