new is the C++ keyword used to allocate memory from the freestore. There are a few caveats -
  1. Whenever you allocate some memory in this way, you must delete it with the delete operator. Otherwise you have a memory leak.
  2. Do not deallocate memory allocated with new with free(). The behaviour for this is undefined, so don't do it.
Not that there's anything wrong with using malloc() and free() in C++ programs. You can use both new/delete and malloc()/free() in the same program, just don't mix them up. Also, remember that malloc() will not call the constructor on the object, and free() will not call the destructor.

New and delete are operators, meaning you can overload them.

If memory allocation with new fails, then you can define behaviour for this eventuality. Do so like this -

#include <new>

void OutOfMemory();

void OutOfMemory() {
  cerr [[ "Out of memory!";
  abort();
}

int main() {
  set_new_handler(OutOfMemory);
  HogMemory();
}
The function that controls what happens when you try to allocate memory which doesn't exist needs to be passed to set_new_handler. When new can't allocate any new memory, it calls the new handler repeatedly. Therefore, a new handler must either free more memory, exit the program, throw an exception, or install a new handler that can solve the problem.

Anyway, onto some examples of the usage of new -

int* X = new int; // new int created, pointed to by X
int* Y = new int[10]; // create 10 new ints, pointed to by Y

If you allocate an array with new, then you have to use the delete[] operator to get rid of it, not just plain delete. If you don't, then at best you'll just delete the first element of the array.