-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strcpy.c
45 lines (41 loc) · 1.54 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
38
39
40
41
42
43
44
45
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mbutt <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/23 20:42:44 by mbutt #+# #+# */
/* Updated: 2019/02/23 21:32:27 by mbutt ### ########.fr */
/* */
/* ************************************************************************** */
/*
** The stpcpy() and strcpy() functions copy the string src to dst (including the
** terminating `\0' character.)
** RETURN VALUES: The strcpy() and strncpy() functions return dst.
*/
#include "libft.h"
char *ft_strcpy(char *dst, const char *src)
{
int i;
i = 0;
while (src[i])
{
dst[i] = src[i];
i++;
}
dst[i] = '\0';
return (dst);
}
/*
** int main (void)
** {
** const char source1[] = "This is Source 1";
** char dest1[] = "This is destination1";
** const char source2[] = "This is Source 2";
** char dest2[] = "This is destination2";
** printf("strcpy: %s\n", strcpy(dest1, source1));
** printf("ft_strcpy: %s\n", ft_strcpy(dest2, source2));
** return(0);
** }
*/