This commit is contained in:
Camille Chauvet
2023-05-17 16:45:25 +00:00
commit 29ed24d567
619 changed files with 16119 additions and 0 deletions

18
C/c00/ex00/ft_putchar.c Normal file
View File

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:47:36 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:39:47 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:49:41 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:42:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_alphabet(void)
{
char a;
a = 'a';
while ('z' >= a)
{
write(1, &a, 1);
a++;
}
}

Binary file not shown.

View File

@ -0,0 +1,23 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_reverse_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:52:57 by cchauvet #+# #+# */
/* Updated: 2022/07/14 13:54:25 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_print_alphabet(void)
{
char a;
a = 'z';
while (a >= 'a')
{
write(1, &a, 1);
a--;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_numbers.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:55:25 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:45:15 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_numbers(void)
{
char a;
a = '0';
while ('9' >= a)
{
write(1, &a, 1);
a++;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_negative.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 14:14:39 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:51:31 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_is_negative(int n)
{
char a;
a = 'N';
if (n > 0)
{
a = 'P';
}
write(1, &a, 1);
}

View File

@ -0,0 +1,54 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 14:18:48 by cchauvet #+# #+# */
/* Updated: 2022/07/14 15:10:35 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_result(char x, char y, char z)
{
ft_putchar(x);
ft_putchar(y);
ft_putchar(z);
if (!((x == '7') && (y == '8') && (z == '9')))
{
ft_putchar(',');
ft_putchar(' ');
}
}
void ft_print_comb(void)
{
char x;
char y;
char z;
x = '0';
while (x <= '7')
{
y = x + 1;
while (y <= '8')
{
z = y + 1;
while (z <= '9')
{
ft_result(x, y, z);
z++;
}
y++;
}
x++;
}
}

View File

@ -0,0 +1,81 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:08:46 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:25:34 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include <stdbool.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
bool ft_sames(char a, char b, char c, char d)
{
char e;
b = a;
if (e != b)
return (false);
e = b;
if (e != c)
return (false);
e = c;
if (e != d)
return (false);
return (true);
}
void ft_result(char a, char b, char c, char d)
{
if (!ft_sames(a, b, c, d))
{
ft_putchar(a);
ft_putchar(b);
ft_putchar(' ');
ft_putchar(c);
ft_putchar(d);
if (!((a == '9') && (b == '8') && (c == '9') && (d == '9')))
{
ft_putchar(',');
ft_putchar(' ');
}
}
}
void ft_print_comb2(void)
{
char a;
char b;
char c;
char d;
a = '0';
while (a <= '9')
{
b = '0';
while (b <= '8')
{
c = '0';
while (c <= '9')
{
d = '0';
while (d <= '9')
{
ft_result(a, b, c, d++);
}
c++;
}
b++;
}
a++;
}
}

36
C/c00/ex07/ft_putnbr.c Normal file
View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 16:46:16 by cchauvet #+# #+# */
/* Updated: 2022/07/14 16:52:22 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char a)
{
write(1, &a, 1);
}
void ft_putnbr(int nb)
{
if (nb < 0)
{
ft_putchar('-');
ft_putnbr(-nb);
}
else if (nb > 10)
{
ft_putnbr(nb / 10);
ft_putchar(nb % 10 + 48);
}
else
{
ft_putchar(nb + 48);
}
}

View File

@ -0,0 +1,4 @@
void ft_print_combn(int n)
{
}

18
C/c00v2/ex00/ft_putchar.c Normal file
View File

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:47:36 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:39:47 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:49:41 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:42:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_alphabet(void)
{
char a;
a = 'a';
while ('z' >= a)
{
write(1, &a, 1);
a++;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_reverse_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:52:57 by cchauvet #+# #+# */
/* Updated: 2022/07/16 10:37:57 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_alphabet(void)
{
char a;
a = 'z';
while (a >= 'a')
{
write(1, &a, 1);
a--;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_numbers.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:55:25 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:45:15 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_numbers(void)
{
char a;
a = '0';
while ('9' >= a)
{
write(1, &a, 1);
a++;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_negative.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 14:14:39 by cchauvet #+# #+# */
/* Updated: 2022/07/16 10:38:55 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_is_negative(int n)
{
char a;
a = 'N';
if (n >= 0)
{
a = 'P';
}
write(1, &a, 1);
}

View File

@ -0,0 +1,54 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 14:18:48 by cchauvet #+# #+# */
/* Updated: 2022/07/14 15:10:35 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_result(char x, char y, char z)
{
ft_putchar(x);
ft_putchar(y);
ft_putchar(z);
if (!((x == '7') && (y == '8') && (z == '9')))
{
ft_putchar(',');
ft_putchar(' ');
}
}
void ft_print_comb(void)
{
char x;
char y;
char z;
x = '0';
while (x <= '7')
{
y = x + 1;
while (y <= '8')
{
z = y + 1;
while (z <= '9')
{
ft_result(x, y, z);
z++;
}
y++;
}
x++;
}
}

36
C/c00v2/ex07/ft_putnbr.c Normal file
View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 16:46:16 by cchauvet #+# #+# */
/* Updated: 2022/07/14 16:52:22 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char a)
{
write(1, &a, 1);
}
void ft_putnbr(int nb)
{
if (nb < 0)
{
ft_putchar('-');
ft_putnbr(-nb);
}
else if (nb > 10)
{
ft_putnbr(nb / 10);
ft_putchar(nb % 10 + 48);
}
else
{
ft_putchar(nb + 48);
}
}

18
C/c00v3/ex00/ft_putchar.c Normal file
View File

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:47:36 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:39:47 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:49:41 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:42:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_alphabet(void)
{
char a;
a = 'a';
while ('z' >= a)
{
write(1, &a, 1);
a++;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_reverse_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:52:57 by cchauvet #+# #+# */
/* Updated: 2022/07/17 13:07:32 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_reverse_alphabet(void)
{
char a;
a = 'z';
while (a >= 'a')
{
write(1, &a, 1);
a--;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_numbers.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:55:25 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:45:15 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_numbers(void)
{
char a;
a = '0';
while ('9' >= a)
{
write(1, &a, 1);
a++;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_negative.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 14:14:39 by cchauvet #+# #+# */
/* Updated: 2022/07/16 10:38:55 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_is_negative(int n)
{
char a;
a = 'N';
if (n >= 0)
{
a = 'P';
}
write(1, &a, 1);
}

View File

@ -0,0 +1,54 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 14:18:48 by cchauvet #+# #+# */
/* Updated: 2022/07/14 15:10:35 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_result(char x, char y, char z)
{
ft_putchar(x);
ft_putchar(y);
ft_putchar(z);
if (!((x == '7') && (y == '8') && (z == '9')))
{
ft_putchar(',');
ft_putchar(' ');
}
}
void ft_print_comb(void)
{
char x;
char y;
char z;
x = '0';
while (x <= '7')
{
y = x + 1;
while (y <= '8')
{
z = y + 1;
while (z <= '9')
{
ft_result(x, y, z);
z++;
}
y++;
}
x++;
}
}

36
C/c00v3/ex07/ft_putnbr.c Normal file
View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 16:46:16 by cchauvet #+# #+# */
/* Updated: 2022/07/14 16:52:22 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char a)
{
write(1, &a, 1);
}
void ft_putnbr(int nb)
{
if (nb < 0)
{
ft_putchar('-');
ft_putnbr(-nb);
}
else if (nb > 10)
{
ft_putnbr(nb / 10);
ft_putchar(nb % 10 + 48);
}
else
{
ft_putchar(nb + 48);
}
}

18
C/c01/ex00/ft_ft.c Normal file
View 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;
}

View 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/c01/ex02/ft_swap.c Normal file
View 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/c01/ex03/ft_div_mod.c Normal file
View 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/14 18:58:24 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_div_mod(int a, int b, int *div, int *mod)
{
*div = a/b;
*mod = a%b;
}

View File

@ -0,0 +1,20 @@
# **************************************************************************** #
# #
# ::: :::::::: #
/* ft_ultimate_div_mod.c :+: :+: :+: */
# +:+ +:+ +:+ #
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/07/14 18:58:45 by cchauvet #+# #+# #
/* Updated: 2022/07/14 19:03:57 by cchauvet ### ########.fr */
# #
# **************************************************************************** #
void ft_ultimate_div_mod(int *a, int *b)
{
int c;
int d;
c = *a/*b;
d = *a%*b;
}

20
C/c01/ex05/ft_putstr.c Normal file
View 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/c01/ex06/ft_strlen.c Normal file
View 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/15 12:03:56 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int ft_strlen(char *str)
{
int a;
a = 0;
while (*str != 0)
{
a++;
str++;
}
return(a);
}

View 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++;
}
}

18
C/c01v1/ex00/ft_ft.c Normal file
View 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;
}

View 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/c01v1/ex02/ft_swap.c Normal file
View 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/c01v1/ex03/ft_div_mod.c Normal file
View 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/14 18:58:24 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_div_mod(int a, int b, int *div, int *mod)
{
*div = a/b;
*mod = a%b;
}

View File

@ -0,0 +1,20 @@
# **************************************************************************** #
# #
# ::: :::::::: #
/* ft_ultimate_div_mod.c :+: :+: :+: */
# +:+ +:+ +:+ #
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/07/14 18:58:45 by cchauvet #+# #+# #
/* Updated: 2022/07/14 19:03:57 by cchauvet ### ########.fr */
# #
# **************************************************************************** #
void ft_ultimate_div_mod(int *a, int *b)
{
int c;
int d;
c = *a/*b;
d = *a%*b;
}

20
C/c01v1/ex05/ft_putstr.c Normal file
View 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/c01v1/ex06/ft_strlen.c Normal file
View 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/15 12:03:56 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int ft_strlen(char *str)
{
int a;
a = 0;
while (*str != 0)
{
a++;
str++;
}
return(a);
}

View 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++;
}
}

18
C/c01v2/ex00/ft_ft.c Normal file
View 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;
}

View 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
View 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
View 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;
}

View 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
View 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
View 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);
}

View 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++;
}
}

18
C/c01v3/ex00/ft_ft.c Normal file
View 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;
}

View 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/c01v3/ex02/ft_swap.c Normal file
View 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/c01v3/ex03/ft_div_mod.c Normal file
View 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;
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_div_mod.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:37:49 by cchauvet #+# #+# */
/* Updated: 2022/07/19 19:06:46 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_ultimate_div_mod(int *a, int *b)
{
int c;
int d;
c = *a / *b;
d = *a % *b;
*a = c;
*b = d;
}

20
C/c01v3/ex05/ft_putstr.c Normal file
View 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);
}
}

24
C/c01v3/ex06/ft_strlen.c Normal file
View File

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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 */
/* */
/* ************************************************************************** */
int ft_strlen(char *str)
{
int a;
a = 0;
while (*str != 0)
{
a++;
str++;
}
return (a);
}

View 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++;
}
}

View File

@ -0,0 +1,52 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_int_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/19 19:08:01 by cchauvet #+# #+# */
/* Updated: 2022/07/19 20:49:46 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
void ft_sort_int_tab(int *tab, int size)
{
int i;
int j;
int tempo;
i = 0;
while (i < size)
{
j = 0;
while (j < size - 1)
{
if (tab[j] > tab[j + 1])
{
tempo = tab[j];
tab[j] = tab[j + 1];
tab[j + 1] = tempo;
}
j++;
}
i++;
}
}
/*
#include <stdio.h>
int main()
{
int tab[] = {6,5,4,3,2,1};
int i = 0;
ft_sort_int_tab(tab, 6);
while (i < 6)
{
printf("%d,", tab[i]);
i++;
}
}
*/

49
C/c02/ex00/ft_strcpy.c Normal file
View File

@ -0,0 +1,49 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
/* Updated: 2022/07/19 12:53:54 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcpy(char *dest, char *src)
{
while (*src != '\0')
{
*dest = *src;
src++;
dest++;
}
*dest = '\0';
return (dest);
}
/*
#include <stdio.h>
#include <string.h>
int main(void)
{
char dest1[10];
char src1[10] = "test";
strcpy(dest1, src1);
printf("%s", dest1);
printf("\n");
char dest2[10];
char src2[10] = "test";
ft_strcpy(dest2, src2);
printf("%s", dest2);
}
*/

53
C/c02/ex01/strncpy.c Normal file
View File

@ -0,0 +1,53 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
/* Updated: 2022/07/19 13:05:06 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
int i;
i = 0;
while (*src != '\0' && i < n)
{
*dest = *src;
src++;
dest++;
i++;
}
dest[n] = 0;
return (dest);
}
/*
#include <stdio.h>
#include <string.h>
int main(void)
{
char dest1[10];
char src1[10] = "test";
strncpy(dest1, src1, 2);
printf("%s", dest1);
printf("\n");
char dest2[10];
char src2[10] = "test";
ft_strncpy(dest2, src2, 2);
printf("%s", dest2);
}
*/

View File

@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_alpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 13:51:45 by cchauvet #+# #+# */
/* Updated: 2022/07/19 13:06:32 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_alpha(char *str)
{
while (*str != 0)
{
if (!(('a' <= *str && *str <= 'z') || ('A' <= *str && 'Z' >= *str)))
{
return (0);
}
str++;
}
return (1);
}
/*
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
int main(void)
{
ft_putchar(ft_str_is_alpha("ff")+'0');
ft_putchar(ft_str_is_alpha("dfdf5f")+'0');
ft_putchar(ft_str_is_alpha("GDGFSGF")+48);
ft_putchar(ft_str_is_alpha("FG5DG")+48);
ft_putchar(ft_str_is_alpha("")+48);
}
*/

View File

@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 15:29:04 by cchauvet #+# #+# */
/* Updated: 2022/07/19 13:08:43 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_numeric(char *str)
{
while (*str != 0)
{
if (!((*str >= '0') && (*str <= '9')))
return (0);
str++;
}
return (1);
}
/*
void ft_putchar(char c)
{
write(1, &c, 1);
}
int main()
{
ft_putchar(ft_str_is_numeric("55654")+48);
ft_putchar(ft_str_is_numeric("ssdf5")+48);
ft_putchar(ft_str_is_numeric("5")+48);
ft_putchar(ft_str_is_numeric("55d654")+48);
ft_putchar(ft_str_is_numeric("")+48);
}
*/

View File

@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_lowercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 13:51:45 by cchauvet #+# #+# */
/* Updated: 2022/07/19 13:09:29 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_lowercase(char *str)
{
while (*str != 0)
{
if (!('a' <= *str && *str <= 'z'))
return (0);
str++;
}
return (1);
}
/*
void ft_putchar(char c)
{
write(1, &c, 1);
}
int main(void)
{
ft_putchar(ft_str_is_lowercase("ff")+'0');
ft_putchar(ft_str_is_lowercase("dfdf5f")+'0');
ft_putchar(ft_str_is_lowercase("d")+48);
ft_putchar(ft_str_is_lowercase("FG5DG")+48);
ft_putchar(ft_str_is_lowercase("")+48);
}
*/

View File

@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_uppercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:46:58 by cchauvet #+# #+# */
/* Updated: 2022/07/19 13:10:32 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_uppercase(char *str)
{
while (*str != 0)
{
if (!('A' <= *str && *str <= 'Z'))
return (0);
str++;
}
return (1);
}
/*
void ft_putchar(char c)
{
write(1, &c, 1);
}
int main(void)
{
ft_putchar(ft_str_is_uppercase("AAA")+'0');
ft_putchar(ft_str_is_uppercase("dfdf5f")+'0');
ft_putchar(ft_str_is_uppercase("Z")+48);
ft_putchar(ft_str_is_uppercase("FG5DG")+48);
ft_putchar(ft_str_is_uppercase("")+48);
}
*/

View File

@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 08:36:39 by cchauvet #+# #+# */
/* Updated: 2022/07/19 13:11:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_printable(char *str)
{
while (*str != 0)
{
if (!(32 <= *str && *str <= 126))
return (0);
str++;
}
return (1);
}
/*
void ft_putchar(char c)
{
write(1, &c, 1);
}
int main(void)
{
ft_putchar(ft_str_is_printable(" ")+48);
ft_putchar(ft_str_is_printable("\n")+48);
ft_putchar(ft_str_is_printable("~")+48);
ft_putchar(ft_str_is_printable("\b")+48);
ft_putchar(ft_str_is_printable("")+48);
}
*/

49
C/c02/ex07/ft_strupcase.c Normal file
View File

@ -0,0 +1,49 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:47:22 by cchauvet #+# #+# */
/* Updated: 2022/07/19 13:11:54 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strupcase(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if ('a' <= str[i] && str[i] <= 'z')
str[i] = str[i] - 32;
i++;
}
return (str);
}
/*
void ft_print(char *str)
{
while (*str != 0)
write(1, str++, 1);
}
int main(void)
{
char a[4] = "test";
ft_print(ft_strupcase(a));
char b[4] = "TEST";
ft_print(ft_strupcase(b));
char c[4] = "t3st";
ft_print(ft_strupcase(c));
char d[4] = "t3St";
ft_print(ft_strupcase(d));
}
*/

View File

@ -0,0 +1,49 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlowcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:47:22 by cchauvet #+# #+# */
/* Updated: 2022/07/19 13:12:30 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlowcase(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if ('A' <= str[i] && str[i] <= 'Z')
str[i] = str[i] + 32;
i++;
}
return (str);
}
/*
void ft_print(char *str)
{
while (*str != 0)
write(1, str++, 1);
}
int main(void)
{
char a[4] = "test";
ft_print(ft_strupcase(a));
char b[4] = "TEST";
ft_print(ft_strupcase(b));
char c[4] = "t3st";
ft_print(ft_strupcase(c));
char d[4] = "t3St";
ft_print(ft_strupcase(d));
}
*/

View File

@ -0,0 +1,51 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcapitalize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:52:54 by cchauvet #+# #+# */
/* Updated: 2022/07/19 12:45:26 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_letter(char c)
{
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))
return (1);
return (0);
}
int ft_is_digit(char c)
{
if ('0' <= c && c <= '9')
return (1);
return (0);
}
char *ft_strcapitalize(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if (!(ft_is_letter(str[i - 1]) || ft_is_digit(str[i - 1])))
if (str[i] >= 'a' && str[i] <= 'z')
str[i] -= 32;
i++;
}
return (str);
}
/*
#include <stdio.h>
int main()
{
char str[] = "salut, comment tu vas ? 42mots quarante-deux; cinquante+et+un";
printf("%s\n", ft_strcapitalize(str));
printf("Salut, Comment Tu Vas ? 42mots Quarante-Deux; Cinquante+Et+Un");
}
*/

38
C/c02v1/ex00/ft_strcpy.c Normal file
View File

@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
/* Updated: 2022/07/20 13:12:32 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcpy(char *dest, char *src)
{
while (*src != '\0')
{
*dest = *src;
src++;
dest++;
}
*dest = '\0';
return (dest);
}
/*
int main(void)
{
char dest[1];
char dest1[1];
char src[] = "abcde";
ft_strcpy(dest, src);
printf("%s \n\n", dest);
strcpy(dest1, src);
printf("%s \n\n", dest);
return (0);
}
*/

47
C/c02v1/ex01/ft_strncpy.c Normal file
View File

@ -0,0 +1,47 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
/* Updated: 2022/07/20 13:25:33 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
unsigned int i;
i = 0;
while (*src != '\0' || i < n)
{
*dest = *src;
src++;
dest++;
i++;
}
return (dest);
}
void ft_print(char *str)
{
while (*str != 0)
{
write(1, str++, 1);
}
}
/*
int main(void)
{
char *a;
char b[6];
b[5] = 'd';
a = "00000";
ft_strncpy(b, a, 5);
ft_print(b);
}
*/

View File

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_alpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 13:51:45 by cchauvet #+# #+# */
/* Updated: 2022/07/17 15:22:03 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_alpha(char *str)
{
while (*str != 0)
{
if (!(('a' <= *str && *str <= 'z') || ('A' <= *str && 'Z' >= *str)))
{
return (0);
}
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 15:29:04 by cchauvet #+# #+# */
/* Updated: 2022/07/18 08:43:44 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_numeric(char *str)
{
while (*str != 0)
{
if (!((*str >= '0') && (*str <= '9')))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_lowercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 13:51:45 by cchauvet #+# #+# */
/* Updated: 2022/07/18 08:36:27 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_lowercase(char *str)
{
while (*str != 0)
{
if (!('a' <= *str && *str <= 'z'))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_uppercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:46:58 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:47:05 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_uppercase(char *str)
{
while (*str != 0)
{
if (!('A' <= *str && *str <= 'Z'))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 08:36:39 by cchauvet #+# #+# */
/* Updated: 2022/07/18 08:36:41 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_printable(char *str)
{
while (*str != 0)
{
if (!(32 <= *str && *str <= 126))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:47:22 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:47:24 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strupcase(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if ('a' <= str[i] && str[i] <= 'z')
str[i] = str[i] - 32;
i++;
}
return (str);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlowcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:47:22 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:49:14 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlowcase(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if ('A' <= str[i] && str[i] <= 'Z')
str[i] = str[i] + 32;
i++;
}
return (str);
}

View File

@ -0,0 +1,72 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcapitalize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:52:54 by cchauvet #+# #+# */
/* Updated: 2022/07/20 13:08:31 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_lower(char c)
{
if ('a' <= c && c <= 'z')
return (1);
return (0);
}
int ft_is_upper(char c)
{
if ('A' <= c && c <= 'Z')
return (1);
return (0);
}
int ft_is_alpha(char c)
{
if (ft_is_lower(c) || ft_is_upper(c))
return (1);
return (0);
}
int ft_is_digit(char c)
{
if ('0' <= c && c <= '9')
return (1);
return (0);
}
char *ft_strcapitalize(char *str)
{
int i;
i = 1;
if (ft_is_lower(str[0]))
str[i] -= 32;
while (str[i] != 0)
{
if (!(ft_is_alpha(str[i - 1]) || ft_is_digit(str[i - 1])))
{
if (ft_is_lower(str[i]))
str[i] -= 32;
}
else
if (ft_is_upper(str[i]))
str[i] += 32;
i++;
}
return (str);
}
/*
#include <stdio.h>
int main()
{
char str[] = "salut, comment tu vas ? 42mots quarante-deux; cinquante+et+un";
printf("%s\n", str);
printf("%s", ft_strcapitalize(str));
}
*/

23
C/c02v2/ex00/ft_strcpy.c Normal file
View File

@ -0,0 +1,23 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
/* Updated: 2022/07/24 11:31:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcpy(char *dest, char *src)
{
while (*src != '\0')
{
*dest = *src;
src++;
dest++;
}
*dest = '\0';
return (dest);
}

26
C/c02v2/ex01/ft_strncpy.c Normal file
View File

@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
/* Updated: 2022/07/24 11:29:29 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
unsigned int i;
i = 0;
while (*src != '\0' || i < n)
{
*dest = *src;
src++;
dest++;
i++;
}
return (dest);
}

View File

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_alpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 13:51:45 by cchauvet #+# #+# */
/* Updated: 2022/07/17 15:22:03 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_alpha(char *str)
{
while (*str != 0)
{
if (!(('a' <= *str && *str <= 'z') || ('A' <= *str && 'Z' >= *str)))
{
return (0);
}
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 15:29:04 by cchauvet #+# #+# */
/* Updated: 2022/07/18 08:43:44 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_numeric(char *str)
{
while (*str != 0)
{
if (!((*str >= '0') && (*str <= '9')))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_lowercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 13:51:45 by cchauvet #+# #+# */
/* Updated: 2022/07/18 08:36:27 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_lowercase(char *str)
{
while (*str != 0)
{
if (!('a' <= *str && *str <= 'z'))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_uppercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:46:58 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:47:05 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_uppercase(char *str)
{
while (*str != 0)
{
if (!('A' <= *str && *str <= 'Z'))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 08:36:39 by cchauvet #+# #+# */
/* Updated: 2022/07/18 08:36:41 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_printable(char *str)
{
while (*str != 0)
{
if (!(32 <= *str && *str <= 126))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:47:22 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:47:24 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strupcase(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if ('a' <= str[i] && str[i] <= 'z')
str[i] = str[i] - 32;
i++;
}
return (str);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlowcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:47:22 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:49:14 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlowcase(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if ('A' <= str[i] && str[i] <= 'Z')
str[i] = str[i] + 32;
i++;
}
return (str);
}

View File

@ -0,0 +1,61 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcapitalize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:52:54 by cchauvet #+# #+# */
/* Updated: 2022/07/24 11:30:49 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_lower(char c)
{
if ('a' <= c && c <= 'z')
return (1);
return (0);
}
int ft_is_upper(char c)
{
if ('A' <= c && c <= 'Z')
return (1);
return (0);
}
int ft_is_alpha(char c)
{
if (ft_is_lower(c) || ft_is_upper(c))
return (1);
return (0);
}
int ft_is_digit(char c)
{
if ('0' <= c && c <= '9')
return (1);
return (0);
}
char *ft_strcapitalize(char *str)
{
int i;
i = 1;
if (ft_is_lower(str[0]))
str[i] -= 32;
while (str[i] != 0)
{
if (!(ft_is_alpha(str[i - 1]) || ft_is_digit(str[i - 1])))
{
if (ft_is_lower(str[i]))
str[i] -= 32;
}
else
if (ft_is_upper(str[i]))
str[i] += 32;
i++;
}
return (str);
}

25
C/c02v3/ex00/ft_strcpy.c Normal file
View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
/* Updated: 2022/07/21 14:10:25 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcpy(char *dest, char *src)
{
int i;
i = 0;
while (src[i] != '\0')
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
return (dest);
}

29
C/c02v3/ex01/ft_strncpy.c Normal file
View File

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
/* Updated: 2022/07/21 19:55:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
unsigned int i;
i = 0;
while (src[i] != '\0' && i < n)
{
dest[i] = src[i];
i++;
}
while (i < n)
{
dest[i] = '\0';
i++;
}
return (dest);
}

View File

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_alpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 13:51:45 by cchauvet #+# #+# */
/* Updated: 2022/07/17 15:22:03 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_alpha(char *str)
{
while (*str != 0)
{
if (!(('a' <= *str && *str <= 'z') || ('A' <= *str && 'Z' >= *str)))
{
return (0);
}
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 15:29:04 by cchauvet #+# #+# */
/* Updated: 2022/07/18 08:43:44 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_numeric(char *str)
{
while (*str != 0)
{
if (!((*str >= '0') && (*str <= '9')))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_lowercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 13:51:45 by cchauvet #+# #+# */
/* Updated: 2022/07/18 08:36:27 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_lowercase(char *str)
{
while (*str != 0)
{
if (!('a' <= *str && *str <= 'z'))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_uppercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:46:58 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:47:05 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_uppercase(char *str)
{
while (*str != 0)
{
if (!('A' <= *str && *str <= 'Z'))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 08:36:39 by cchauvet #+# #+# */
/* Updated: 2022/07/18 08:36:41 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_printable(char *str)
{
while (*str != 0)
{
if (!(32 <= *str && *str <= 126))
return (0);
str++;
}
return (1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:47:22 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:47:24 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strupcase(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if ('a' <= str[i] && str[i] <= 'z')
str[i] = str[i] - 32;
i++;
}
return (str);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlowcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:47:22 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:49:14 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlowcase(char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if ('A' <= str[i] && str[i] <= 'Z')
str[i] = str[i] + 32;
i++;
}
return (str);
}

View File

@ -0,0 +1,61 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcapitalize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:52:54 by cchauvet #+# #+# */
/* Updated: 2022/07/22 09:20:34 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_lower(char c)
{
if ('a' <= c && c <= 'z')
return (1);
return (0);
}
int ft_is_upper(char c)
{
if ('A' <= c && c <= 'Z')
return (1);
return (0);
}
int ft_is_alpha(char c)
{
if (ft_is_lower(c) || ft_is_upper(c))
return (1);
return (0);
}
int ft_is_digit(char c)
{
if ('0' <= c && c <= '9')
return (1);
return (0);
}
char *ft_strcapitalize(char *str)
{
int i;
i = 1;
if (ft_is_lower(str[0]))
str[0] -= 32;
while (str[i] != 0)
{
if (!(ft_is_alpha(str[i - 1]) || ft_is_digit(str[i - 1])))
{
if (ft_is_lower(str[i]))
str[i] -= 32;
}
else
if (ft_is_upper(str[i]))
str[i] += 32;
i++;
}
return (str);
}

29
C/c02v3/ex10/ft_strlcpy.c Normal file
View File

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/21 14:13:53 by cchauvet #+# #+# */
/* Updated: 2022/07/21 14:18:18 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlcpy(char *dest, char *src, unsigned int n)
{
unsigned int i;
i = 0;
while (src[i] != '\0' && dest[i] != '\0' && i < n)
{
dest[i] = src[i];
i++;
}
while (i < n && dest[i] != '\0')
{
dest[i] = '\0';
i++;
}
return (i);
}

BIN
C/c02v4.tar Normal file

Binary file not shown.

25
C/c02v4/ex00/ft_strcpy.c Normal file
View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 15:08:22 by cchauvet #+# #+# */
/* Updated: 2022/07/21 14:10:25 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcpy(char *dest, char *src)
{
int i;
i = 0;
while (src[i] != '\0')
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
return (dest);
}

Some files were not shown because too many files have changed in this diff Show More