Consider following code:
int main()
{
char c;
for(;(c=getchar())+1;)
printf("%c\n",c);
}
It gets characters what I enter in terminal and prints them. When I remove +1
in condition, program works but it doesnt stop when EOF
(Ctrl+D) signal. When I change it to +2
same problem.
My question is how that +1
work? Is it something related to getchar()
or for
loop?