代码:
#include<stdio.h>
#define NEWSIZE 1000
char newbuf[NEWSIZE];
char *newp=newbuf;
int main(){
。。。。。
}
//分配空间
char *new(int n){
if((newp+n)<=newbuf+NEWSIZE)
{
newp+=n;
return newp-n;
}else
return NULL;
}
//释放空间
void free(char *p)
{
if(p<=newbuf+NEWSIZE&&p>newbuf)
newp=p;
}