Using getChar() in a while loop

Posted by GOPI on Stack Overflow See other posts from Stack Overflow or by GOPI
Published on 2010-03-31T00:47:39Z Indexed on 2010/03/31 0:53 UTC
Read the original article Hit count: 420

Filed under:
|
#include <stdio.h>
main()
{
    int c ;
    while ((c = getchar()) != EOF)
    {
        int isEOF = (c==EOF);
        printf("is %c EOF: %d ", c, isEOF);
    }
}

Why printf() method is called twice on every input char here?

© Stack Overflow or respective owner

Related posts about while

    Related posts about getchar