Sobes.tech
Junior — Senior

Determine the program output with a function using a reference and post-increment

livecode

Task condition

Determine what text will be output to the console after executing the following code fragment.

#include <iostream>
using namespace std;

void f(int& x) {
    cout << x++;
}

int main() {
    int a = 1;
    int& b = a;
    f(a);
    cout << b;
    return 0;
}