Question from the C++ - Fundamentals test

Write a C++ function that increments its input parameter and prints the result.

Easy

What does the following code display ?

void f(int x) {
    x = x + 1;
    cout << "x=" << x << endl;
}

int main() {
   int val(1);
   f(val);
   cout << "val=" << val << endl;
   return 0;
}
Author: SamuelStatus: PublishedQuestion passed 323 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!