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.
19 lines
227 B
19 lines
227 B
2 years ago
|
#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);
|
||
|
}
|
||
|
|