-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path\
More file actions
31 lines (27 loc) · 1.11 KB
/
\
File metadata and controls
31 lines (27 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: atiampae <atiampae@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/28 12:46:27 by atiampae #+# #+# */
/* Updated: 2022/10/28 13:14:35 by atiampae ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s1)
{
char *ans;
size_t len;
len = ft_strlen(s1);
if (!(ans = (char *)ft_calloc(1, len)))
return (0);
len = 0;
while (s1[len] != '\0')
{
ans[len] = s1[len];
len++;
}
return (ans);
}