fixed some stuff (100%)

This commit is contained in:
LinlyBoi
2023-08-21 11:22:58 +03:00
parent ac332f48ac
commit 64d38b771d
4 changed files with 27 additions and 28 deletions

View File

@@ -5,14 +5,14 @@
*
* @str: Address to the head of the string (Array of Characters) (Lost btw)
*
* Returns: Length of String
* Return: Length of String
*/
int _strlen(const char *str)
{
if (*str)
return (1 + _strlen(++str));
else
return (0);
if (*str)
return (1 + _strlen(++str));
else
return (0);
}
/**
@@ -25,13 +25,13 @@ int _strlen(const char *str)
*/
int _contains(const char *str, char c)
{
if (*str)
{
if (*str == c && *(str + 1) != c && *(str - 1) != c)
return (1 + _contains(str + 1, c));
else
return (_contains(str + 1, c));
}
else
return (0);
if (*str)
{
if (*str == c && *(str + 1) != c && *(str - 1) != c)
return (1 + _contains(str + 1, c));
else
return (_contains(str + 1, c));
}
else
return (0);
}