maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_strchr.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_strchr.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: rmikhayl <rmikhayl@student.42london.c +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2023/12/17 17:25:26 by rmikhayl #+# #+# */
9
/* Updated: 2023/12/17 17:25:26 by rmikhayl ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "
libft.h
"
14
15
/* *************************** ft_strchr ************************************ */
16
/* Searches for the first occurrence of the character 'c' in the string */
17
/* 's'. Returns a pointer to the first match if found; otherwise, returns */
18
/* NULL. */
19
/* */
20
/* In layman's terms: It's like finding a specific letter or symbol in a */
21
/* written text. If the letter is there, it tells you where to look; if not,*/
22
/* it says there's nothing to find. */
23
/* ************************************************************************** */
24
25
char
*
ft_strchr
(
const
char
*s,
int
c)
26
{
27
unsigned
char
uc;
28
29
uc = (
unsigned
char)c;
30
while
(*s !=
'\0'
&& *s != uc)
31
s++;
32
if
(*s == uc)
33
return
((
char
*)s);
34
return
(NULL);
35
}
ft_strchr
char * ft_strchr(const char *s, int c)
Definition
ft_strchr.c:25
libft.h
lib
libft
src
ft_strchr.c
Generated by
1.9.8