ExamVeda
Login
Home
Functions and Procedures in C plus plus
?

What will be the output of the following C++ code?
#include <iostream>
#include <exception>
using namespace std;
int main()
{
    try 
    {
        int * array1 = new int[100000000];
        int * array2 = new int[100000000];
        int * array3 = new int[100000000];
        int * array4 = new int[100000000];
        cout << "Allocated successfully";
    }
    catch(bad_alloc&) 
    {
        cout << "Error allocating the requested memory." << endl;
    }
    return 0;
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.