i would like to add one more point, though its not really necessary , it will still work without this Check, but its adviced to have these checks.

int *p=(int*)malloc(32*sizeof(int));
if(NULL != p)
//Check to see proper allocation of memory
....Do your Stuff....
else{
//Not enough memory
}