Comparing unsigned char and EOF
The golden rule for writing this line is while ((ch = fgetc(stdin)) != EOF) ch should be int .Your cute trick of making ch unsigned fails because EOF is a signed int quantity. Ok, let’s now go into the depth…… Step 1: ch=fgetc(fp) fgetc() returns -1 (a signed int). By the golden rules of C … Read more