This commit is contained in:
Timo Schmidt 2023-03-24 02:14:06 +01:00
parent 29cb1556ea
commit 31d486102a
1 changed files with 40 additions and 0 deletions

40
ex02/ft_strcat.c Normal file
View File

@ -0,0 +1,40 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/24 02:04:46 by tischmid #+# #+# */
/* Updated: 2023/03/24 02:14:00 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcat(char *s1, char *s2)
{
char *orig_s1;
orig_s1 = s1;
while (*s1)
++s1;
while (*s2)
*s1++ = *s2++;
*s1 = 0;
return (orig_s1);
}
/* ////
#include <stdio.h>
#define STR1 ""
#define STR2 "a"
int main(void)
{
char s1[] = STR1;
char s2[] = STR2;
printf("s1 %s s2 %s\n", s1, s2);
ft_strcat(s1, s2);
printf("s1 %s s2 %s\n", s1, s2);
return (0);
}
*/ ////