can this code print end of file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

can this code print end of file

#include<stdio.h> int main() { int a; a=getchar(); if (a==EOF) { putchar(a); } } if its wrong, pls correct me

3rd Jan 2018, 12:20 PM
‎ ‏‏‎Anonymous Guy
5 Answers
+ 5
Hold down Ctrl, press Z. It's ASCII 26.
3rd Jan 2018, 1:05 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
And also you can write the same code with reading from file, you should see the same result.
3rd Jan 2018, 2:24 PM
Petr Leliaev
Petr Leliaev - avatar
+ 1
How can you input the EOF character in getchar() using keyboard?
3rd Jan 2018, 12:32 PM
Petr Leliaev
Petr Leliaev - avatar
0
i don't know it was in this book c programming language -by BRIAN W KERNIGHAN & DENNIS M.RITCHIE ex no 1.7 write a program to print the value of eof
3rd Jan 2018, 12:38 PM
‎ ‏‏‎Anonymous Guy
0
thanks guys
3rd Jan 2018, 3:33 PM
‎ ‏‏‎Anonymous Guy