/** Dynamically allocate and use an array. */ #include using namespace std; int main() { const int SIZE = 10; double *arrayPtr = new double[SIZE]; // create block to hold array /* You can use subscript notation [] to access an array: */ for(int i = 0; i < SIZE; i++) { arrayPtr[i] = i * i; } /* or pointer arithmetic: */ for(int i = 0; i < SIZE; i++) { cout << *(arrayPtr + i) << endl; } return 0; }