Vidyalelo
C++ Programming · Q82

Pointers and References in C++

Programming · C++ Programming · question 82

Q82

What will be the output of the following C++ code? #include using namespace std; int &fun() static int x = 10; return x; int main() fun() = 30; cout << fun(); return 0;

A.
30
Answer
B.
10
C.
Error
D.
Segmentation fault

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board