哈挺加工中心排屑器程序或M代码

如题所述

第1个回答  2016-06-18
char *alloc(int n) /* return pointer to n characters */
{
if (allocbuf + ALLOCSIZE - allocp >= n) { /* it fits */
allocp += n;
return allocp - n; /* old p */
} else /* not enough room */
return 0;
}

void afree(char *p) /* free storage pointed to by p */
{
if (p >= allocbuf && p < allocbuf + ALLOCSIZE)
allocp = p;
}

/* strcpy: copy t to s; array subscript version */
void strcpy(char *s, char *t)
{
int i;

i = 0;
while ((s[i] = t[i]) != '\0')
i++;
}本回答被网友采纳