Added memorybook to parsing and cleaned most of the files
This commit is contained in:
33
libs/libft/srcs/ft_strchr.c
Normal file
33
libs/libft/srcs/ft_strchr.c
Normal file
@@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strchr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/11/25 13:56:46 by hulamy #+# #+# */
|
||||
/* Updated: 2019/11/25 13:56:47 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/*
|
||||
** locate the first occurence of character c in string s
|
||||
** and return pointer to its location
|
||||
*/
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
char *ft_strchr(const char *s, int c)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
i = 0;
|
||||
j = -1;
|
||||
while (s[i])
|
||||
i++;
|
||||
while (++j < i + 1)
|
||||
if (s[j] == c)
|
||||
return ((char *)s + j);
|
||||
return (NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user