int ungetc(int c, FILE *fp)
pushes the character c back into fp, and returns either c, or EOF
for an error.
where as int putc(int c, FILE *fp)
writes the character c into the file fp and returns the character written, or EOF
for an error.
//These are the statements from K&R. I find myself confused, because putc()
can be used after getc
and can work as ungetc
. So whats the use in specifically defining ungetc()
.