Push libft
125/100 corrected the 14/11/23
This commit is contained in:
commit
7bd66aee5b
45 changed files with 1462 additions and 0 deletions
29
ft_strrchr.c
Normal file
29
ft_strrchr.c
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strrchr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/07 16:58:22 by rparodi #+# #+# */
|
||||
/* Updated: 2023/11/11 18:46:54 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
char *ft_strrchr(const char *s, int c)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
i = ft_strlen(s);
|
||||
while (i > 0)
|
||||
{
|
||||
if (s[i] == c % 256)
|
||||
return ((char *)s + i);
|
||||
i--;
|
||||
}
|
||||
if (s[i] == c % 256)
|
||||
return ((char *)s + i);
|
||||
return (NULL);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue