Write a routine ungets(s) that will push back an entire string onto the input. Should ungets know about buf and bufp, or should it just use ungetch?
This is pretty straightforward. It can just use ungetch for every char in a string.
As zer0325 points out ungetch does the same thing a routine using buf and bufp would be doing anyway.
void ungets(char s[])
{
int i = 0;
do {
ungetch(s[i]);
} while(s[i++] != '\0');
}
No Output