I'm learning C++ and I ran into a bit of code that I'm confused on what exactly it does. I'm learning dynamic memory and the place I'm learning it from mentioned that this was good practice.
double * pvalue = NULL;
if(!(pvalue = new double)){
cout<<"Error: out of memory." << endl;
exit(1);
}
I understand that you are creating a pointer called pvalue, but I don't understand the if statement. If someone could explain it to me I'd be greatly appreciated.