this program comes from "the c programming language" chapter 6, section 5 of Kremr
< H2 > partial code < / H2 >-sharpinclude<stdio.h>
-sharpdefine BUFSIZE 100
char buf[BUFSIZE];
int bufcp = 0;
int getch(void)
{
int c;
if(bufcp > 0)
c = buf[--bufcp];
else
c = getchar();
return c;
}
void ungetch(int c)
{
if (bufcp < BUFSIZE)
buf[bufcpPP] = c;
else
printf("error: the buf is over!\n");
}
description
Thegetword function is used to read in a word