Projet de l'école 42 : Libft
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

18 lines
227 B

#include "../libft.h"
char *ft_strnew(int n, char c)
{
char *str;
str = NULL;
if (n < 0)
return (NULL);
str = malloc(n + 1);
if (!str)
return (NULL);
str[n] = '\0';
while (--n >= 0)
str[n] = c;
return (str);
}