Going through K&R I too a look at the following code:
#define ALLOCSIZE 1000
static char allocbuf[MAXLINE];
static char *allocp = allocbuf
char *alloc(int n){
if (allocbuf+ALLOCSIZE-allocp>=n){
allocp+=n;
return allocp-n;
}
else { ... }
I'm afraid my question is very simple, but I can't get my head round the "if" line. What value is allocbuf taking? It is a char array, right? I looked back at the array stuff in the book, but it didn't help. allocp initially points to the zeroth element of the array, right?