strstr not functioning
问题 Why does this particular piece of code return false on the strstr() if I input \"test\"? char input[100]; int main() { fgets(input, 100, stdin); printf(\"%s\", input); if(strstr(\"test message\", input)) { printf(\"strstr true\"); } } I thought strstr searched the first param for instances of the second param? It works when I replace input with some text or just assign it something directly, but it seems to not work with fgets. 回答1: It's because fgets stores the newline character so when