logo CodeStepByStep logo

parameterMystery3

The following code produces 4 lines of output. What is the output? Write each line of output as it would appear on the console.

null
void parameterMystery3(int* a, int& b, int* c) {
    *a += *c;
    (*c)++;
    b--;
    cout << b << " " << *a << " " << *c << endl;
}

int main() {
    int w = 0;
    int x = 1;
    int y = 3;
    int z = 7;

    parameterMystery3(&y, x, &w);
    parameterMystery3(&x, y, &z);
    parameterMystery3(&w, w, &z);

    cout << w << " " << x << " " << y << " " << z << endl;
    return 0;
}

line 1
line 2
line 3
line 4

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.