// Read characters until eof // Andrew Taylor - andrewt@unsw.edu.au // 22/4/2017 #include int main(void) { int ch; // getchar returns an int which will contain either // the ASCII code of the character read or EOF // using an assignment in a loop/if condition is // not recommended for noviceprogrammers // but is used widely by experienced C programmers while ((ch = getchar()) != EOF) { printf("you entered the character: '%c' which has ASCII code %d\n", ch, ch); } return 0; }