-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strchr.c
More file actions
34 lines (32 loc) · 1.32 KB
/
ft_strchr.c
File metadata and controls
34 lines (32 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jowagner <jowagner@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/12 14:02:31 by jowagner #+# #+# */
/* Updated: 2024/12/18 22:33:02 by jowagner ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Locates the first occurrence of the character c in the string s.
*
* @param s The string to be searched.
* @param c The character to locate (converted to a char).
* @return A pointer to the first occurrence of c in s,
* or NULL if c is not found.
*/
char *ft_strchr(const char *s, int c)
{
while (*s)
{
if (*s == (char)c)
return ((char *)s);
s++;
}
if (*s == (char)c)
return ((char *)s);
return (NULL);
}