creation du main de testing et du test de abs

This commit is contained in:
hugogogo
2021-08-10 16:40:52 +02:00
parent bcbe2086f5
commit d8aaada7fc
91 changed files with 4430 additions and 159 deletions

View File

@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/25 13:56:54 by hulamy #+# #+# */
/* Updated: 2019/11/25 13:56:55 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
/*
** save a copy of string src by allocating memory and return pointer to copy
*/
#include "libft.h"
char *ft_strdup(const char *src)
{
int i;
char *str;
i = 0;
while (src[i] != '\0')
i++;
if (!(str = (char*)malloc(sizeof(*str) * (i + 1))))
return (NULL);
while (i-- >= 0)
str[i + 1] = src[i + 1];
return (str);
}