type * var{nullptr}
declares a pointer to a type and initializes it to nullptr.
nullptr
, NULL or 0 are all pointers to nothing
type * new type;
type * new type[const int expression]
delete pointerVar;
delete[] pointerVar;
int * ary{new int[size]}; ... delete [] ary;
int * ary{nullptr} ... ary = new int [newSize]; ... if (ary != nullptr) { // some operation on the array. } ... if (array != nullptr) { delete[] ary; }
type function (type *& var)
to pass by reference.