I wrote a test program thinking that the address of p1 will be less than p2, but when I compiled the code, the address of p2 turned out to be lower (p1 is 8 units larger than p2). I also heard rumors that 2 adjacent memory blocks will combine themselves automatically. Does that play any part in the following code?
void main(){
char *p1, *p2;
p1=malloc(4);
p2=malloc(5);
p1="yah";
p2="goog";
printf(" p1 = %d, and p2 = %d \n", p1, p2);
}