✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Consider the following code fragment:
namespace a {
namespace b {
int f(int x, int y=1) { return x + y; }
}
int f(int x) { return x > 1 ? x + 1 : a::b::f(x - 1); }
}
int g(int x) {
return x % 3 == 0 ? a::b::f(x, 3) : a::f(x);
}
What is the value returned by g(x)
for when x
equals 1, 2, and 3 respectively?
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!