I am wondering what is the right/standard way to use malloc and free. Is it needed to set pointer NULL after free? Basically, which of the two following ways is correct?
double* myPtr = (double*)malloc(sizeof(double)*5);
.....
free(myPtr);
or
double* myPtr = (double*)malloc(sizeof(double)*5);
.....
free(myPtr);
myPtr = NULL;
Or it should be other ways to use malloc and free? Thanks.