-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strchr.c
More file actions
46 lines (41 loc) · 1.5 KB
/
ft_strchr.c
File metadata and controls
46 lines (41 loc) · 1.5 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
35
36
37
38
39
40
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: simarcha <simarcha@student.42barcel> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/10 17:29:27 by simarcha #+# #+# */
/* Updated: 2024/01/26 19:07:01 by simarcha ### ########.fr */
/* */
/* ************************************************************************** */
//#include <string.h>
//#include <stdio.h>
#include "libft.h"
char *ft_strchr(const char *str, int c)
{
int i;
i = 0;
while (str[i] != '\0')
{
if ((unsigned char)c == (unsigned char)str[i])
return ((char *)str + i);
i++;
}
if ((unsigned char)c == (unsigned char)str[i])
return ((char *)str + i);
return (NULL);
}
/*
int main(void)
{
char tweet[] = "tripouille";
char *mention = strchr(tweet, 0);
printf("mention: __%s__\n", mention);
char *simon = ft_strchr(tweet, 0);
printf("Simon's: __%s__\n", simon);
//printf("Lib : %p\n", mention);
//printf("Sim : %p\n", simon);
//mention[0] = '*';
//printf("%s\n", tweet);
}*/