Add main.* and remove .gitignore
This commit is contained in:
41
C_Piscine_C_03/git/ex03/main.c
Normal file
41
C_Piscine_C_03/git/ex03/main.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/12 16:21:11 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/12 16:44:38 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char *ft_strncat(char *dest, char *src, unsigned int nb);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char src[32];
|
||||
char dest[32];
|
||||
char dest2[32];
|
||||
unsigned int nb;
|
||||
char *r;
|
||||
|
||||
nb = 0;
|
||||
printf("Input String #1 [max 31]: ");
|
||||
scanf("%s", src);
|
||||
printf("Input String #2 [max 31]: ");
|
||||
scanf("%s", dest);
|
||||
printf("Input Number: ");
|
||||
scanf("%u", &nb);
|
||||
strcpy(dest2, dest);
|
||||
r = ft_strncat(dest, src, nb);
|
||||
printf("src=%s dest=%s nb=%d result=%s (ft_strncat)\n", src, dest, nb, r);
|
||||
r = strncat(dest2, src, nb);
|
||||
printf("src=%s dest=%s nb=%d result=%s (strncat)\n", src, dest2, nb, r);
|
||||
return (0);
|
||||
}
|
||||
Reference in New Issue
Block a user