1.

What is the output of this program?
#include <iostream>
#include <new>
using namespace std;
int main ()
{
int k, num;
int * ptr;
num = 3;
ptr= new (nothrow) int[num];
if (ptr == 0)
cout << "Error: memory could not be allocated";
else
{
for (k=0; k {
ptr[num] = 7;
}
for (k = 0; k < num; k++)
cout << ptr[num] << " ";
delete[] ptr;
}
return 0;
}

A. 3
B. 7
C. 7 7
D. 7 7 7
E. None of these
Answer» E. None of these


Discussion

No Comment Found

Related MCQs