To read a declaration, read from the variable name, first to the right, then to the left, and make parentheses matter. Thus:
void * func(); // func is a function returning pointer to voidvoid (*func)(); // func is a pointer to a function returning voidint & * ptr; // ptr is a pointer to a reference to an int, which is illegalint * & ptr; // ptr is a reference to a pointer to an int, which is fineinline void DeletePointer( int * & ptr ){ delete ptr; ptr = 0;}
Or, more flexibly:
template< class T >void DeletePointer( T * & ptr ){ delete ptr; ptr = 0;}
Of course, if you allocate with new[], you have to delete with delete[].