-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strdup.c
More file actions
27 lines (23 loc) · 1.1 KB
/
ft_strdup.c
File metadata and controls
27 lines (23 loc) · 1.1 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hlimouni <hlimouni@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/21 11:27:18 by hlimouni #+# #+# */
/* Updated: 2021/05/30 16:51:21 by hlimouni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
char *ft_strcpy(char *dest, char *src);
char *ft_strdup(const char *str)
{
char *ptr;
unsigned int i;
ptr = malloc(ft_strlen(str) + 1);
if (ptr == NULL)
return (NULL);
ft_strcpy(ptr, str);
return (ptr);
}