base struct
This commit is contained in:
26
lib/libft/srcs/str/ft_strrchr.c
Normal file
26
lib/libft/srcs/str/ft_strrchr.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strrchr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/14 09:06:01 by nalebrun #+# #+# */
|
||||
/* Updated: 2024/11/25 16:16:38 by nalebrun ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../libft.h"
|
||||
|
||||
char *ft_strrchr(const char *s, int c)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!s)
|
||||
return (NULL);
|
||||
i = ft_strlen(s) + 1;
|
||||
while (--i >= 0)
|
||||
if (s[i] == (char)c)
|
||||
return ((char *)&s[i]);
|
||||
return (NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user