Right here:
pls help urgently
Your program wouldn't end right because you had EOF with single quotation marks, around them.
We told you that, and we told you that was wrong, and we posted the corrected program code.
But you argue on...
Ctrl + c just *SEEMS* like it works - but here's the thing: the keyboard buffer is only read and gives input to the operating system, so many times each second. So when you press ctrl + c it may *seem* like it's acting differently, maybe like it's being accepted as EOF by your program:
It is not!
It's just that exactly *when* your program is terminated by the ctrl+c, is not going to always be at exactly the same moment, each time. Each keystroke has to be intercepted and read by the OS, and then put into a queue to have that request, done.
How about something else?
Try that and see if you like it.Code:#define ESC 27 //just below your #include files - note - no semi-colon! int c = 0; while((c=getchar()) != ESC) { //any other loop logic, in here }