hmm weird same thing:
Code:#include <stdio.h> #include <string.h> #include <ctype.h> int main() { char somestring[100]; printf("Please enter a string\n"); fgets(somestring, 100, stdin); //the following will rebuild the string to get rid of any new lines so we can compare //it with "test". int i; int stringLength = strlen(somestring); for (i=0; i < stringLength; i++) { if (somestring[i] != '\n'){ somestring[i] = somestring[i]; } } printf("\n%d", strcmp(somestring, "test")); return 0; }