when we declared to a pointer either it may carry char type values or it may carry int or float type values...after declaration ...it get memory at runtime either using malloc or not using malloc...if we had not done malloc...then it may provide us memory through whereever it found memory in RAM...UNTILL when we got free space our pointer will be allocated fine ..bt ...a stage comes when it can't get free space thereon continonous ...it will give segmentation fault...
BUT when we do malloc .....it checks for block of memory for which demand is considered.......by using
(typecasting*)malloc(sizeof(ptr type*));
eg.
(int*)malloc(sizeof(int*));
where ever it found that block of memory ,,,it provides us that memory...if it find that base address it is going to provide has not enough size as block is demanded...it leaves that address & make try to find another block which should be atleast as per memory demanded....so memory provided to us using malloc will be atleast that memory which we have demanded...if it could not able to get demanded memory on RAM, when it will through message representing memory addresses ...we may consider it as we can't get demanded memory....