ft_strchr
Subject
STRCHR(3) (simplified)
NAME
strchr -- locate character in string
SYNOPSIS
char *strchr(const char *s, int c);
DESCRIPTION
The strchr() function locates the first occurence of c (converted to a char) in the string pointed to by s. The terminating null character is considered to be part of the string; therefor if c is '\0', the function locate the terminating '\0'.
RETURN VALUES
The function strchr() return a pointer to the located character, or NULL if the character does not appear in the string.Understandable explanation
Hints
char *ft_strchr(const char *s, int c)
{
/* loop over the whole string */
/* check if current character is equal to the one we have to find */
/* once we looped over the whole string, check again for the character
* in case the character we have to find is '\0'
*/
/* if we didn't find c in the string, return NULL */
}Commented solution
Last updated