#include <iostream>
#include <new>
using std::cout;
using std::endl;
#define SIZE 16
int main()
{
int *p;
try {
p = new int[SIZE];
}
catch (std::bad_alloc &ba) {
cout << "Allocation error: " << ba.what() << endl;
return 1;
}
for (int i = 0; i < SIZE; i++)
p[i] = i;
for (int i = 0; i < SIZE; i++)
cout << p[i] << " ";
delete[] p;
cout << endl;
return 0;
}
/*
run:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
*/