init
This commit is contained in:
49
C/c02/ex00/ft_strcpy.c
Normal file
49
C/c02/ex00/ft_strcpy.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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);
|
||||
}
|
||||
*/
|
Reference in New Issue
Block a user