C++ examples for Data Type:Array Pointer
The equivalence of pointers and arrays
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv []) { int *someInts = new int [10]; if (someInts==NULL) { /*from w w w . j a va 2 s . c om*/ return (-1); } int i=0; while (i<10) { someInts[i] = 10-i; i++; } i=0; while (i<10) { cout << someInts[i] << endl; i++; } delete [] someInts; return 0; }