ft_strchr, norming ft_strcpy, ft_strncat, ft_strncpy

This commit is contained in:
Tanguy MAZE 2018-04-04 19:22:29 +02:00
parent 727ec54307
commit 698a37b399
5 changed files with 31 additions and 8 deletions

View File

@ -6,7 +6,7 @@
# By: tmaze <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/04/04 10:51:59 by tmaze #+# #+# #
# Updated: 2018/04/04 18:34:41 by tmaze ### ########.fr #
# Updated: 2018/04/04 18:59:36 by tmaze ### ########.fr #
# #
#******************************************************************************#
@ -23,6 +23,7 @@ SRCS = \
ft_strncpy.c \
ft_strcat.c \
ft_strncat.c \
ft_strchr.c \
ft_isalpha.c \
ft_isdigit.c \
ft_isalnum.c \

24
ft_strchr.c Normal file
View File

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/04 18:54:17 by tmaze #+# #+# */
/* Updated: 2018/04/04 19:15:12 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
int i;
i = -1;
while (++i == 0 || s[i - 1])
if (s[i] == c)
return (strdup(&s[i]));
return (NULL);
}

View File

@ -6,7 +6,7 @@
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/04 16:15:42 by tmaze #+# #+# */
/* Updated: 2018/04/04 16:39:29 by tmaze ### ########.fr */
/* Updated: 2018/04/04 19:19:41 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
@ -21,4 +21,3 @@ char *ft_strcpy(char *dest, const char *src)
dest[i] = src[i];
return (dest);
}

View File

@ -6,7 +6,7 @@
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/04 18:29:06 by tmaze #+# #+# */
/* Updated: 2018/04/04 18:34:17 by tmaze ### ########.fr */
/* Updated: 2018/04/04 19:20:04 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/04 16:55:29 by tmaze #+# #+# */
/* Updated: 2018/04/04 17:14:03 by tmaze ### ########.fr */
/* Updated: 2018/04/04 19:21:06 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
@ -23,4 +23,3 @@ char *ft_strncpy(char *dest, const char *src, size_t n)
dest[i] = '\0';
return (dest);
}