50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strcpy.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
|
|
/* Updated: 2022/07/19 12:53:54 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
char *ft_strcpy(char *dest, char *src)
|
|
{
|
|
while (*src != '\0')
|
|
{
|
|
*dest = *src;
|
|
src++;
|
|
dest++;
|
|
}
|
|
*dest = '\0';
|
|
return (dest);
|
|
}
|
|
|
|
/*
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
int main(void)
|
|
{
|
|
char dest1[10];
|
|
char src1[10] = "test";
|
|
|
|
strcpy(dest1, src1);
|
|
|
|
printf("%s", dest1);
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
char dest2[10];
|
|
char src2[10] = "test";
|
|
|
|
ft_strcpy(dest2, src2);
|
|
|
|
printf("%s", dest2);
|
|
}
|
|
*/
|