diff options
Diffstat (limited to 'rushs/tinyprintf/my_strstr')
| -rw-r--r-- | rushs/tinyprintf/my_strstr/my_strstr.c | 34 | ||||
| -rw-r--r-- | rushs/tinyprintf/my_strstr/my_strstr.h | 6 |
2 files changed, 0 insertions, 40 deletions
diff --git a/rushs/tinyprintf/my_strstr/my_strstr.c b/rushs/tinyprintf/my_strstr/my_strstr.c deleted file mode 100644 index 36ac439..0000000 --- a/rushs/tinyprintf/my_strstr/my_strstr.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "my_strstr.h" - -#include <stddef.h> - -int my_strstr(const char *haystack, const char *needle) -{ - if (needle == NULL || *needle == '\0') - { - return 0; - } - - for (int i = 0; haystack[i]; i++) - { - if (haystack[i] == needle[0]) - { - int j; - for (j = 0; - haystack[i + j] && needle[j] && needle[j] == haystack[i + j]; - j++) - { - continue; - } - if (needle[j] == '\0') - { - return i; - } - if (haystack[i + j] == '\0') - { - return -1; - } - } - } - return -1; -} diff --git a/rushs/tinyprintf/my_strstr/my_strstr.h b/rushs/tinyprintf/my_strstr/my_strstr.h deleted file mode 100644 index 1b734b2..0000000 --- a/rushs/tinyprintf/my_strstr/my_strstr.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MY_STRSTR_H -#define MY_STRSTR_H - -int my_strstr(const char *haystack, const char *needle); - -#endif /* ! MY_STRSTR_H */ |
