init
This commit is contained in:
18
C/c01v2/ex00/ft_ft.c
Normal file
18
C/c01v2/ex00/ft_ft.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_ft.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/14 15:22:16 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/14 18:33:56 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_ft(int *nbr)
|
||||
{
|
||||
*nbr = 42;
|
||||
}
|
16
C/c01v2/ex01/ft_ultimate_ft.c
Normal file
16
C/c01v2/ex01/ft_ultimate_ft.c
Normal file
@ -0,0 +1,16 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_ultimate_ft.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/14 18:27:16 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/14 18:53:31 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_ultimate_ft(int *********nbr)
|
||||
{
|
||||
*********nbr = 42;
|
||||
}
|
20
C/c01v2/ex02/ft_swap.c
Normal file
20
C/c01v2/ex02/ft_swap.c
Normal file
@ -0,0 +1,20 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_swap.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/14 18:46:50 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/15 10:51:16 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_swap(int *a, int *b)
|
||||
{
|
||||
int tempo;
|
||||
|
||||
tempo = *a;
|
||||
*a = *b;
|
||||
*b = tempo;
|
||||
}
|
17
C/c01v2/ex03/ft_div_mod.c
Normal file
17
C/c01v2/ex03/ft_div_mod.c
Normal file
@ -0,0 +1,17 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_div_mod.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/14 18:58:15 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/18 10:35:36 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_div_mod(int a, int b, int *div, int *mod)
|
||||
{
|
||||
*div = a / b;
|
||||
*mod = a % b;
|
||||
}
|
20
C/c01v2/ex04/ft_ultimate_div_mod.c
Normal file
20
C/c01v2/ex04/ft_ultimate_div_mod.c
Normal file
@ -0,0 +1,20 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_ultimate_div_mod.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/18 10:37:49 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/18 10:38:35 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_ultimate_div_mod(int *a, int *b)
|
||||
{
|
||||
int c;
|
||||
int d;
|
||||
|
||||
c = *a / *b;
|
||||
d = *a % *b;
|
||||
}
|
20
C/c01v2/ex05/ft_putstr.c
Normal file
20
C/c01v2/ex05/ft_putstr.c
Normal file
@ -0,0 +1,20 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putstr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/14 19:06:11 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/14 19:18:13 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_putstr(char *str)
|
||||
{
|
||||
while (*str != 0)
|
||||
{
|
||||
write(1, str++, 1);
|
||||
}
|
||||
}
|
25
C/c01v2/ex06/ft_strlen.c
Normal file
25
C/c01v2/ex06/ft_strlen.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strlen.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/14 19:06:11 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/18 10:34:56 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include <unistd.h>
|
||||
|
||||
int ft_strlen(char *str)
|
||||
{
|
||||
int a;
|
||||
|
||||
a = 0;
|
||||
while (*str != 0)
|
||||
{
|
||||
a++;
|
||||
str++;
|
||||
}
|
||||
return (a);
|
||||
}
|
32
C/c01v2/ex07/ft_rev_int_tab.c
Normal file
32
C/c01v2/ex07/ft_rev_int_tab.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_rev_int_tab.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/15 09:31:51 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/15 10:54:35 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_swap(int *a, int *b)
|
||||
{
|
||||
int tempo;
|
||||
|
||||
tempo = *a;
|
||||
*a = *b;
|
||||
*b = tempo;
|
||||
}
|
||||
|
||||
void ft_rev_int_tab(int *tab, int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (i < size / 2)
|
||||
{
|
||||
ft_swap(tab + i, tab + size - i - 1);
|
||||
i++;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user