blob: c018e5a63a32b88d3c035c2044e5c5de4aaa0ada (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/29 00:12:40 by cacharle #+# #+# */
/* Updated: 2019/10/29 00:12:52 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "header.h"
#define MIN_INT (1 << 31)
#define MAX_INT (~(1 << 31))
int strrchr_index(const char *s, char c)
{
int i;
i = ft_strlen((char*)s) - 1;
while (s[i] != c)
{
if (i == 0)
return (-1);
i--;
}
return (i);
}
|