Vidyalelo
C++ Programming · Q488

C++ miscellaneous

Programming · C++ Programming · question 488

Q488

What will be the output of the following C++ code? #include using namespace std; int main() int a = 5; int b = 5; auto check = [&a]() a = 10; b = 10; check(); cout<<"Value of a: "<<a<<endl; cout<<"Value of b: "<<b<<endl; return 0;

A.
Value of a: 5
B.
Value of a: 10
C.
Error
Answer
D.
Segmentation fault

Answer: Option C

Solution

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