#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>

extern int edata, etext, end;
char *buffer3;
char *buffer4;

#define SHW_ADR(ID,I) printf("The id %s is at addr: %8X \n", ID, &I)

int main()
{
	char *buffer1, *buffer2;	
	
	
	printf ("\n This is initial state \n");

        printf(" \t etext: %8X \t edata: %8X \t end: %8X \n", &etext, &edata, &end);

	SHW_ADR("buffer3", buffer3);

	printf(" \n Value returned by sbrk: %8X \n",sbrk(300));

	printf(" \t etext: %8X \t edata: %8X \t end: %8X \n", &etext, &edata, &end);

	buffer3=(char *) malloc((unsigned) 50);
	SHW_ADR("buffer3", buffer3);
	
	SHW_ADR("buffer4", buffer4);	

	buffer1=(char *) malloc((unsigned) 10);
	SHW_ADR("buffer1", buffer1);

        buffer2=(char *) malloc((unsigned) 10);
        SHW_ADR("buffer2", buffer2);
	
	return(0);
}
