ajout libft en dure

This commit is contained in:
hugodu69
2020-06-24 17:42:50 +02:00
parent a1b21caa35
commit dca24e1312
88 changed files with 5283 additions and 18 deletions

32
libft/srcs/ft_strrchr.c Normal file
View File

@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/25 13:58:20 by hulamy #+# #+# */
/* Updated: 2019/11/25 13:58:21 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
/*
** locate the last occurence of character c in string s
** and return pointer to its location
*/
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
int i;
i = 0;
while (s[i])
i++;
i++;
while (i--)
if (s[i] == c)
return ((char *)s + i);
return (NULL);
}