diff --git a/src/string/strstr.c b/src/string/strstr.c new file mode 100644 index 0000000..4586058 --- /dev/null +++ b/src/string/strstr.c @@ -0,0 +1,14 @@ +char *strstr(const char *haystack, const char *needle) +{ + size_t i = 0; + size_t len; + + len = strlen(needle); + while (haystack[i] != '\0') + { + if (strncmp(haystack + i, needle, len) == 0) + return haystack + i; + i++; + } + return NULL; +}