[Solved] strncmp don’t work as it should
strcmp & strncmp functions return 0 if strings are equal. You should do: if (strncmp(frase1, frase3, 4) == 0) … i.e.: char *str1 = “Example 1”; char *str2 = “Example 2”; char *str3 = “Some string”; char *str4 = “Example 1”; if (strncmp(str1, str2, 7) == 0) printf(“YES\n”); // “Example” <-> “Example” else printf(“NO\n”); if … Read more