-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strcpy.c
executable file
·37 lines (32 loc) · 1.29 KB
/
ft_strcpy.c
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
31
32
33
34
35
36
37
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akharrou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/18 15:23:55 by akharrou #+# #+# */
/* Updated: 2019/05/12 09:22:01 by akharrou ### ########.fr */
/* */
/* ************************************************************************** */
#include "../Includes/string_42.h"
#include "../Includes/stdlib_42.h"
char *ft_strcpy(char *dst, const char *src)
{
unsigned int i;
i = 0;
while (*src)
dst[i++] = *src++;
dst[i] = *src;
return (dst);
}
char *ft_strcpyfre(char *dst, const char *src, int free_dst, int free_src)
{
char *res;
res = ft_strcpy(dst, src);
if (free_dst && dst)
free(dst);
if (free_src && src)
free((char *)src);
return (res);
}