No offense, but that's some of the fugliest code I've seen in a long time.
fgets includes a newline, and isspace returns true on newlines. However, your for loop breaks on the first space character from the end of a string. A newline might be a cr/lf combo. The user input might also have multiple trailing spaces.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum