ft_striteri, ft_striter: changed int to unsigned int

This commit is contained in:
Tanguy MAZE 2018-04-07 11:52:54 +02:00
parent 1cb14a826a
commit a3462b7b10
3 changed files with 27 additions and 4 deletions

View File

@ -6,7 +6,7 @@
# By: tmaze <marvin@42.fr> +#+ +:+ +#+ # # By: tmaze <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2018/04/04 10:51:59 by tmaze #+# #+# # # Created: 2018/04/04 10:51:59 by tmaze #+# #+# #
# Updated: 2018/04/07 11:22:24 by tmaze ### ########.fr # # Updated: 2018/04/07 11:42:48 by tmaze ### ########.fr #
# # # #
#******************************************************************************# #******************************************************************************#
@ -50,7 +50,8 @@ SRCS = \
ft_strnew.c \ ft_strnew.c \
ft_strdel.c \ ft_strdel.c \
ft_strclr.c \ ft_strclr.c \
ft_striter.c ft_striter.c \
ft_striteri.c
OBJS = $(SRCS:.c=.o) OBJS = $(SRCS:.c=.o)
INCLS = -I. INCLS = -I.

View File

@ -6,7 +6,7 @@
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */ /* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/07 11:17:26 by tmaze #+# #+# */ /* Created: 2018/04/07 11:17:26 by tmaze #+# #+# */
/* Updated: 2018/04/07 11:20:40 by tmaze ### ########.fr */ /* Updated: 2018/04/07 11:41:57 by tmaze ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,7 +14,7 @@
void ft_striter(char *s, void (*f)(char*)) void ft_striter(char *s, void (*f)(char*))
{ {
int i; unsigned int i;
i = 0; i = 0;
while (s[i]) while (s[i])

22
ft_striteri.c Normal file
View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striteri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/07 11:36:12 by tmaze #+# #+# */
/* Updated: 2018/04/07 11:48:32 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_striteri(char *s, void (*f)(unsigned int, char*))
{
unsigned int i;
i = -1;
while (s[++i])
(*f)(i, &s[i]);
}