Страницы

Translate

суббота, 24 августа 2013 г.

Exercise 4-7. Write a routine ungets(s) that will push back an entire string onto the input.

Exercise 4-7. 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?


#include <string.h>

/* ungets */
void ungets( char s[])
{
    int len;
    
    len = strlen(s);
    while(len > 0)
        ungetch(s[--len]);
}

 Ungets should not know about buf and bufp, and it just use ungetch.

Комментариев нет:

Отправить комментарий