-
What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
char* p;
unsigned long int num = (size_t(0) / 3);
cout << num << endl;
try
{
p = new char[size_t(0) / 3];
delete[ ] p;
}
catch(bad_alloc &TheBadAllocation)
{
cout << TheBadAllocation.what() << endl;
};
return 0;
}
-
- 5
- 0
- depends on compiler
- bad_alloc
- None of these
Correct Option: B
As we are dividing the zero by three, it is returning 0.