the printf function always prints 11 on the console output.I am running and compiling the above with MS VS 2008 under Win Vista.(I know its weired running such an old fashioned piece of code with this machine..)
I know its weired running such an old fashioned piece of code with this machine.
I take offense to that, sir!
There's a problem with your condition. the assignment operator has a lower precedence than the inequality operator, so your expression is equivalent to ch=(getchar()!=EOF), not (ch=getchar())!=EOF.
Suppose you typed a<enter>. The first 1 comes from 'a'!=EOF being true, the second comes from '\n'!=EOF being true.
Us backend programmers find it offensive to imply that console interfaces are obsolete. They are not, and you should never listen to anyone who tells you otherwise. They are just unpopular with the current generation of casual computer users.
Great/Horrible programs either are great/horrible regardless of their interface, or how they take advantage of their particular interface is part of what makes them great/horrible.