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

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_program_name.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/20 14:55:51 by cchauvet #+# #+# */
/* Updated: 2022/07/20 14:59:25 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void print(char *str)
{
while (*str != 0)
write(1, str++, 1);
}
int main(int argc, char **argv)
{
if (argc > 0)
print(argv[0]);
}

View File

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/20 14:55:51 by cchauvet #+# #+# */
/* Updated: 2022/07/20 15:02:54 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void print(char *str)
{
while (*str != 0)
write(1, str++, 1);
}
int main(int argc, char **argv)
{
int i;
i = 1;
while (i < argc)
{
print(argv[i]);
print("\n");
i++;
}
}

BIN
C/c06/ex02/a.out Executable file

Binary file not shown.

View File

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rev_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/20 14:55:51 by cchauvet #+# #+# */
/* Updated: 2022/07/20 15:06:49 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void print(char *str)
{
while (*str != 0)
write(1, str++, 1);
}
int main(int argc, char **argv)
{
int i;
i = argc - 1;
while (i > 0)
{
print(argv[i]);
print("\n");
i--;
}
}

View File

@ -0,0 +1,77 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/20 16:37:02 by cchauvet #+# #+# */
/* Updated: 2022/07/20 16:58:45 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print(char *str)
{
while (*str != 0)
write(1, str++, 1);
}
int ft_strcmp(char *s1, char *s2)
{
while ((*s1 != 0 ) && (*s2 != 0) && (*s1 == *s2))
{
s1++;
s2++;
}
return (*s1 - *s2);
}
int ft_get_size(char *str)
{
int i;
i = 0;
while (str[i] != 0)
i++;
return (i);
}
void ft_sort_int_tab(char **tab, int size)
{
int i;
int j;
char *tempo;
i = 0;
while (i < size)
{
j = 0;
while (j < size - 1)
{
if (ft_strcmp(tab[j], tab[j + 1]) > 0)
{
tempo = tab[j];
tab[j] = tab[j + 1];
tab[j + 1] = tempo;
}
j++;
}
i++;
}
}
int main(int argc, char **argv)
{
int i;
i = 1;
ft_sort_int_tab(argv + 1, argc - 1);
while (i < argc)
{
ft_print(argv[i]);
ft_print("\n");
i++;
}
}