Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main(){
- long cnt; // chars count
- int c;
- /* Why the 'for' cicle doesn't finish when I input the
- * "a^Z" string and press ENTER? At this case '^Z' is
- * CTRL + Z (i.e this is EOF). I expected the second loop
- * will get the EOF (i.e. -1), but it has 26 instead of. Why?
- */
- for(cnt = 0; (c = getchar()) != EOF; ++cnt)
- ;
- printf("Chars count: %ld", cnt);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement