A
Q. What is the output of the following C++ program?
Code:
#include<iostream>
using namespace std;
int &f() {
static int x = 10;
return x;
}
int main() {
int &y = f();
y = y +5;
cout << f();
return 0;
}
using namespace std;
int &f() {
static int x = 10;
return x;
}
int main() {
int &y = f();
y = y +5;
cout << f();
return 0;
}
- Correct Answer - Option(C)
- Views: 20
- Filed under category C++
- Hashtags:
Discusssion
Login to discuss.