In C++, it is best to judge the pointer when using the memory dynamically requested by new

int *p =NULL;

p = new int [10];

if(p==NULL)

  return 0;

Reason: There may be unsuccessful memory application.

Guess you like

Origin blog.csdn.net/modi000/article/details/113877739