It seems that there should be “fgetc(stdin);
” at the end of the line “fgets(ROW, W+1, stdin);
” in the default code for C language for the Chess cavalry puzzle.
I’ve replaced it with a scanf instead.
AFAIU fgets() with buffer length W+1 reads W characters at most, because (W+1)th character must be the null-terminator.
This leaves newline unread in the input stream.
Providing a larger buffer for fgets() should be enough.