quries

Ambitious contributor
21May2008,19:26   #1
answerme's Avatar
I have 2 queries
1. what this line means which is in bold
2.Up to how many times it will loop back
Code:
main()
{
int c ;
int count=0 ;

while ( ( c = getchar() ) != EOF )
   count ++ ;

printf( "%d characters\n" , count );
}
Go4Expert Member
23May2008,10:51   #2
mr.anandc's Avatar
1. what this line means which is in bold
while ( ( c = getchar() ) != EOF )

In this line, first getchar waits to for input from user and then the iput is assigned to "c ", and "c" value is compared against EOF.

2.Up to how many times it will loop back
In windows, getchar returns EOF when the iput is (ctrl + z). So it loop backs until (ctrl + z) is entered.

So, count prints, number of characters read so far.