What will be the output of the following C++ code?
#include<iostream>
using namespace std;
int main()
{
int x = 5;
auto check = []() -> bool
{
if(x == 0)
return false;
else
return true;
};
cout<<check()<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main()
{
int x = 5;
auto check = []() -> bool
{
if(x == 0)
return false;
else
return true;
};
cout<<check()<<endl;
return 0;
}A. 1
B. 0
C. Error
D. Segmentation fault
Answer: Option C

Join The Discussion