0
0

Add all git folders

This commit is contained in:
Baco
2021-08-15 23:30:40 +02:00
parent 0abd1f86bc
commit a808b91a50
123 changed files with 2391 additions and 0 deletions

7
C_Piscine_C_04/git/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
**/main.c
**/main.sh
**/a.out
**/a.sh
**/Makefile
**/*.swp
**/*~

View File

@@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/13 09:03:26 by gbaconni #+# #+# */
/* Updated: 2021/08/13 09:09:57 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
char *p_str;
p_str = str;
while (*p_str != '\0')
p_str++;
return (p_str - str);
}

View File

@@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/13 09:16:54 by gbaconni #+# #+# */
/* Updated: 2021/08/13 09:21:15 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putstr(char *str)
{
char *p_str;
p_str = str;
while (*p_str != '\0')
write(1, p_str++, 1);
}

View File

@@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/13 09:24:02 by gbaconni #+# #+# */
/* Updated: 2021/08/13 14:47:24 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putnbr(int nb)
{
char c;
if (nb == -2147483648)
write(1, "-2147483648", 11);
else if (nb >= 10)
{
ft_putnbr(nb / 10);
ft_putnbr(nb % 10);
}
else if (nb < 0)
{
write(1, "-", 1);
nb *= -1;
ft_putnbr(nb / 10);
ft_putnbr(nb % 10);
}
else if (nb >= 0)
{
c = nb + '0';
write(1, &c, 1);
}
}

View File

@@ -0,0 +1,39 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/13 12:46:22 by gbaconni #+# #+# */
/* Updated: 2021/08/13 14:58:30 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
int ft_atoi(char *str)
{
int nb;
int s;
int i;
nb = 0;
s = 0;
i = 0;
while (str[i] != '\0')
{
if (str[i] == ' ' || (str[i] >= '\t' && str[i] <= '\r'))
s += 0;
else if (str[i] == '+')
s++;
else if (str[i] == '-')
s--;
else if (str[i] >= '0' && str[i] <= '9')
nb = nb * 10 + str[i] - '0';
else
break ;
i++;
}
if (s < 0)
nb *= -1;
return (nb);
}