init
This commit is contained in:
39
Correction/thellego/ex00/ft_strcpy.c
Normal file
39
Correction/thellego/ex00/ft_strcpy.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strcpy.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: thellego <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/16 13:44:49 by thellego #+# #+# */
|
||||
/* Updated: 2022/07/20 10:51:58 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
char *ft_strcpy(char *dest, char *src)
|
||||
{
|
||||
int counter;
|
||||
|
||||
counter = 0;
|
||||
while (*src != '\0')
|
||||
{
|
||||
|
||||
dest[counter] = src[counter];
|
||||
counter++;
|
||||
}
|
||||
dest[counter] = '\0';
|
||||
return (dest);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
char tab1[120] = "Hello world jjhaflhsuid ai;eiwjejvhds jdg";
|
||||
char tab[120] = "";
|
||||
|
||||
tab1[0] = 8;
|
||||
ft_strcpy(tab, tab1);
|
||||
printf("%s\n", tab1);
|
||||
printf("%s\n", tab);
|
||||
}
|
Reference in New Issue
Block a user