The operator new allocates memory for the specified data type and returns a pointer:
// g++ tst.cpp #include <iostream> using namespace std; main() { int *i = new int(123); cout << *i << endl; delete i; int *j; j = new int(456); cout << *j << endl; delete j; int *k = new int[5]; for( int i = 0; i < 5; i++) { k[i] = i; cout << k[i] << endl; } delete [] k; }