ex03
This commit is contained in:
parent
74c1a86164
commit
f91dafa6bb
|
@ -0,0 +1,42 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strncat.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/03/24 02:14:28 by tischmid #+# #+# */
|
||||||
|
/* Updated: 2023/03/24 02:20:08 by tischmid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
char *ft_strncat(char *dest, char *src, unsigned int nb)
|
||||||
|
{
|
||||||
|
char *orig_dest;
|
||||||
|
|
||||||
|
orig_dest = dest;
|
||||||
|
while (*dest)
|
||||||
|
++dest;
|
||||||
|
while (*src && nb--)
|
||||||
|
*dest++ = *src++;
|
||||||
|
*dest = 0;
|
||||||
|
return (orig_dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ////
|
||||||
|
#include <stdio.h>
|
||||||
|
#define STR1 "0123"
|
||||||
|
#define STR2 "abc"
|
||||||
|
#define LENGTH 2
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
char s1[] = STR1;
|
||||||
|
char s2[] = STR2;
|
||||||
|
printf("Length: %d\n", LENGTH);
|
||||||
|
printf("s1: %s s2: %s\n", s1, s2);
|
||||||
|
ft_strncat(s1, s2, LENGTH);
|
||||||
|
printf("s1: %s s2: %s\n", s1, s2);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
*/ ////
|
Loading…
Reference in New Issue