Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
yabtaour
GitHub Repository: yabtaour/Minishell-42
Path: blob/main/utils/ft_strchr.c
1407 views
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_strchr.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: yabtaour <[email protected]> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2022/07/26 18:13:32 by yabtaour #+# #+# */
9
/* Updated: 2022/07/26 18:17:42 by yabtaour ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "../minishell.h"
14
15
char *ft_strchr(char *s, int c)
16
{
17
int i;
18
unsigned char *str;
19
unsigned char k;
20
21
k = (unsigned char)c;
22
str = (unsigned char *)s;
23
i = 0;
24
while (str[i] != '\0' && str[i] != k)
25
i++;
26
if (str[i] != k)
27
return (NULL);
28
else
29
return ((char *)str + i);
30
}
31
32