remove recurssive function + commented main

This commit is contained in:
David Gailleton
2025-11-11 13:49:56 +01:00
parent c4e4c7c141
commit c722e2b87d
18 changed files with 93 additions and 140 deletions

View File

@@ -6,15 +6,24 @@
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/05 17:24:37 by dgaillet #+# #+# */
/* Updated: 2025/11/06 12:38:20 by dgaillet ### ########lyon.fr */
/* Updated: 2025/11/11 12:36:25 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
if ((unsigned char) s[0] == (unsigned char) c)
return ((char *) s);
if (!s[0])
return (0);
return (ft_strchr(s + 1, c));
int i;
i = 0;
while (s[i])
{
if ((unsigned char) s[i] == (unsigned char) c)
return ((char *) s + i);
i++;
}
if ((unsigned char) s[i] == (unsigned char) c)
return ((char *) s + i);
return (NULL);
}