Update Final 42

This commit is contained in:
lclerel- lclerel-
2026-03-23 14:47:43 +01:00
parent 9e30071258
commit 3b8d303f77
72 changed files with 3268 additions and 12 deletions
Submodule Memory Management/C-System-Interface deleted from 4b8aa8530c
@@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_program_name.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/19 15:36:50 by lclerel- #+# #+# */
/* Updated: 2026/03/19 18:05:56 by lclerel- ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int main(int argc, char **argv)
{
int i;
(void)argc;
i = 0;
while (argv[0][i] != '\0')
i++;
write(1, argv[0], i);
write(1, "\n", 1);
}
@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/19 16:03:11 by lclerel- #+# #+# */
/* Updated: 2026/03/19 18:05:40 by lclerel- ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int main(int argc, char **argv)
{
int i;
int len;
(void)argc;
i = 1;
while (i < argc)
{
len = 0;
while (argv[i][len] != '\0')
len++;
write(1, argv[i], len);
write(1, "\n", 1);
i++;
}
return (0);
}
@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rev_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/19 16:09:13 by lclerel- #+# #+# */
/* Updated: 2026/03/19 18:05:23 by lclerel- ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int main(int argc, char **argv)
{
int i;
int len;
(void)argc;
i = argc - 1;
while (i > 0)
{
len = 0;
while (argv[i][len] != '\0')
len++;
write(1, argv[i], len);
write(1, "\n", 1);
i--;
}
return (0);
}
@@ -0,0 +1,68 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/19 16:47:37 by lclerel- #+# #+# */
/* Updated: 2026/03/19 18:09:21 by lclerel- ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (s1[i] != '\0' && s1[i] == s2[i])
i++;
return (s1[i] - s2[i]);
}
void ft_display(int argc, char **argv)
{
int i;
int len;
i = 1;
while (i < argc)
{
len = 0;
while (argv[i][len])
len++;
write(1, argv[i], len);
write(1, "\n", 1);
i++;
}
}
int main(int argc, char **argv)
{
int i;
int j;
char *temp;
if (argc < 2)
return (0);
i = 1;
while (i < argc - 1)
{
j = i + 1;
while (j < argc)
{
if (ft_strcmp(argv[i], argv[j]) > 0)
{
temp = argv[i];
argv[i] = argv[j];
argv[j] = temp;
}
j++;
}
i++;
}
ft_display(argc, argv);
return (0);
}