• C

Conversion

How do I trap the value of EOF?

main()
{
int c;
c=getchar();
while(c != EOF)
putchar(c);
c=getchar();
}
}
JMarshallAsked:
Who is Participating?
 
imladrisConnect With a Mentor Commented:
How about:

main()
{
int c;

do
{   c=getchar();
    putchar(c);
} while(c != EOF)
}
}

P.S. You could also find what the value is by inspecting stdio.h.

0
 
JMarshallAuthor Commented:
Please rewrite code to print the Value of EOF!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.