What will be the output of the following C++ code?
#include<iostream>
#include<any>
using namespace std;
int main()
{
float val = 5.5;
any var(val);
if(var.has_value())
{
cout<<"Var is not Empty\n";
}
else
{
cout<<"Var is Empty\n";
}
return 0;
}
#include<iostream>
#include<any>
using namespace std;
int main()
{
float val = 5.5;
any var(val);
if(var.has_value())
{
cout<<"Var is not Empty\n";
}
else
{
cout<<"Var is Empty\n";
}
return 0;
}A. Var is Empty
B. Var is not Empty
C. Error
D. Segmentation fault
Answer: Option B

Join The Discussion