#define ALLOCSIZE 10000 /* size of available space */
static char allocbuff[ALLOCSIZE]; /* STORAGE FOR alloc */
static char *allocp = allocbuff; /* next free position */
char *alloc(int n) /* return pointer to n characters */
{
if(allocbuff + ALLOCSIZE -allocp >=n) /*it fits */
{
allocp += n;
return allocp - n; /* old p */
}
else /*not enough room */
return 0;
}
in the above code allocp is pointer which is assigned with allocbuff which is the starting element address of allocbuff but why in comments it has been given that (char * allcop=allocbuff )will point to the next free element how is it possible it has to point to the first element naa
if allocp and allocbuff were both the stating element address why cant we directly give ALLOCSIZE>=N in if condition
code is as per dennis ritchie c book and topic is from address arithmetic