mirror of
https://github.com/Ladebeze66/libft.git
synced 2025-12-13 04:36:55 +01:00
30 lines
1.1 KiB
C
Executable File
30 lines
1.1 KiB
C
Executable File
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strrchr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/02/09 16:10:11 by fgras-ca #+# #+# */
|
|
/* Updated: 2023/02/14 15:36:23 by fgras-ca ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
char *ft_strrchr(const char *s, int c)
|
|
{
|
|
int i;
|
|
|
|
i = 0;
|
|
while (s[i])
|
|
i++;
|
|
while (i >= 0)
|
|
{
|
|
if (s[i] == (char)c)
|
|
return ((char *)(s + i));
|
|
i--;
|
|
}
|
|
return (0);
|
|
}
|