//------------------------------------------------------------------------- // // dynamic.cpp // // Written by: Simon Parsons // Last modified: 24th November 2007 // A program to illustrate dynamic memory allocation //------------------------------------------------------------------------- // // Headers #include #include using namespace std; //------------------------------------------------------------------------- // // main int main() { int *data; int size; cout << "\nenter array size: "; cin >> size; assert( size > 0 ); data = new int[size]; // allocate array of ints assert( data != 0 ); for ( int j=0; j