init
This commit is contained in:
BIN
Correction/titou/ex03/a.out
Executable file
BIN
Correction/titou/ex03/a.out
Executable file
Binary file not shown.
35
Correction/titou/ex03/ft_strncat.c
Normal file
35
Correction/titou/ex03/ft_strncat.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strncat.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/18 19:02:00 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/25 10:43:26 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
char *ft_strncat(char *dest, char *src, unsigned int nb)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
|
||||
i = 0;
|
||||
while (dest[i] != 0)
|
||||
i++;
|
||||
j = 0;
|
||||
while (src[j] != 0 && j < nb)
|
||||
{
|
||||
dest[i + j] = src[j];
|
||||
j++;
|
||||
}
|
||||
dest[i + j] = 0;
|
||||
return (dest);
|
||||
}
|
||||
#include <stdio.h>
|
||||
int main(){
|
||||
char tab[] = "camille est beau";
|
||||
char tab2[] = "Camille est beau";
|
||||
printf("%s", ft_strncat(tab, tab2, 10));
|
||||
}
|
Reference in New Issue
Block a user