-
What is the output of this program?
#include
#include
using namespace std;
int main()
{
try
{
int * arr1 = new int[100000000];
int * arr2 = new int[100000000];
int * arr3 = new int[100000000];
int * arr4 = new int[100000000];
cout << "Memory Allocated successfully";
}
catch(bad_alloc&)
{
cout << "Error allocating the requested memory." << endl;
}
return 0;
}
-
- Depends on the memory of the computer
- Allocated successfully
- Error allocating the requested memory
- All of above
- None of these
Correct Option: A
In this program, we allocating the memory to the arrays by using exception handling and we handled the exception by standard exception.