-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strcpy.c
48 lines (42 loc) · 1.39 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
46
47
48
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gabdoush <[email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/09/21 20:46:17 by gabdoush #+# #+# */
/* Updated: 2021/09/21 20:46:19 by gabdoush ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *ft_strcpy(char *dst, const char *src)
{
int n;
n = 0;
while (src[n] != '\0')
{
dst[n] = src[n];
n++;
}
dst[n] = '\0';
return (dst);
}
int main()
{
char dst[] = "";
const char src[] = "Ghaiath Abdoush";
printf("ft_strcpy is :\n%s\n--------\n", ft_strcpy(dst, src));
printf("strcpy is :\n%s\n--------\n", strcpy(dst, src));
if (ft_strcpy(dst, src) == strcpy(dst, src))
{
printf("True\n");
}
else
{
printf("False\n");
}
return EXIT_SUCCESS;
}