练习4-7 编写一个函数ungets(s),将整个字符串s压回到输入中。ungets函数需要使用buf和bufp吗?它能否仅使用ungetch函数?
需要间接使用buf和bufp
void ungets(char s[])
{int len = strlen(s);while (len-- > 0){ungetch(s[len])}return;
}
练习4-7 编写一个函数ungets(s),将整个字符串s压回到输入中。ungets函数需要使用buf和bufp吗?它能否仅使用ungetch函数?
需要间接使用buf和bufp
void ungets(char s[])
{int len = strlen(s);while (len-- > 0){ungetch(s[len])}return;
}