Infinitely(endless loop).
Because of the C Operator Precedence table !=(Not equal to) has higher precedence than =(assignment) [http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm]. So the while condition actually is:
while( c = ( getchar() != 0 ) )
{
}
This doesn't give output of getchar to c variable to compare it with 0. If we print the output by using
int c;
while(c=getchar()!=0)
{
printf("%d",c);
}
Then for any input(eg. 0,1,01234,hi,etc.) we will always get 111... being printed continuously till we reach the output limit. If we do not give any input then it will run endlessly. I am unable to figure out why it is giving only one. Maybe you can help me there.
NOTE: Variable 'c' must not be of type char and lower size than char to avoid anomalies. See Common Mistake section at: https://en.wikibooks.org/wiki/C_Programming/stdio.h/getchar