if ( fgets( line, sizeof(line), stdin ) == (char*) 0 )...
I don\'t understand what this line does,anyone knows?
It is simply checking the results of fgets for null character pointer.
According to cplusplus.com
Return Value
On success, the function returns the same str parameter. If the End-of-File is encountered and no characters have been read, the contents of str remain unchanged and a null pointer is returned.
If an error occurs, a null pointer is returned.
Use either ferror or feof to check whether an error happened or the End-of-File was reached.