Compare commits
10 Commits
0eae69e75e
...
eb935cf908
| Author | SHA1 | Date |
|---|---|---|
|
|
eb935cf908 | |
|
|
62772db390 | |
|
|
1ebb907e4a | |
|
|
d7d6227a00 | |
|
|
5d07bdd66c | |
|
|
8056af83db | |
|
|
e6e33e4160 | |
|
|
475f0e4ba7 | |
|
|
048ebb2961 | |
|
|
f6e1accb9e |
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/17 20:37:49 by tischmid #+# #+# */
|
||||
/* Updated: 2023/03/17 20:53:13 by tischmid ### ########.fr */
|
||||
/* Updated: 2023/03/19 05:23:08 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -16,7 +16,6 @@ void ft_ft(int *nbr)
|
|||
}
|
||||
|
||||
/* ////
|
||||
#define START
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
|
|
@ -25,5 +24,6 @@ int main(void)
|
|||
|
||||
ft_ft(nbr);
|
||||
printf("%d\n", *nbr);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_ultimate_ft.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/19 04:55:47 by tischmid #+# #+# */
|
||||
/* Updated: 2023/03/19 05:23:01 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_ultimate_ft(int *********nbr)
|
||||
{
|
||||
*********nbr = 42;
|
||||
}
|
||||
|
||||
/* ////
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int *********ptr;
|
||||
int p0;
|
||||
int *p1;
|
||||
int **p2;
|
||||
int ***p3;
|
||||
int ****p4;
|
||||
int *****p5;
|
||||
int ******p6;
|
||||
int *******p7;
|
||||
int ********p8;
|
||||
|
||||
p0 = 40;
|
||||
p1 = &p0;
|
||||
p2 = &p1;
|
||||
p3 = &p2;
|
||||
p4 = &p3;
|
||||
p5 = &p4;
|
||||
p6 = &p5;
|
||||
p7 = &p6;
|
||||
p8 = &p7;
|
||||
ptr = &p8;
|
||||
ft_ultimate_ft(ptr);
|
||||
printf("%d\n", *********ptr);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_swap.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/19 05:05:51 by tischmid #+# #+# */
|
||||
/* Updated: 2023/03/19 05:22:55 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_swap(int *a, int *b)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
tmp = *a;
|
||||
*a = *b;
|
||||
*b = tmp;
|
||||
}
|
||||
|
||||
/* ////
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
|
||||
a = 1;
|
||||
b = 2;
|
||||
printf("%d, %d\n", a, b);
|
||||
ft_swap(&a, &b);
|
||||
printf("%d, %d\n", a, b);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_div_mod.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/19 05:17:56 by tischmid #+# #+# */
|
||||
/* Updated: 2023/03/19 05:22:50 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_div_mod(int a, int b, int *div, int *mod)
|
||||
{
|
||||
*div = a / b;
|
||||
*mod = a % b;
|
||||
}
|
||||
|
||||
/* ////
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int div;
|
||||
int mod;
|
||||
|
||||
ft_div_mod(10, 3, &div, &mod);
|
||||
printf("div %d mod %d\n", div, mod);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_ultimate_div_mod.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/19 05:22:13 by tischmid #+# #+# */
|
||||
/* Updated: 2023/03/19 05:26:34 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_ultimate_div_mod(int *a, int *b)
|
||||
{
|
||||
int div;
|
||||
int mod;
|
||||
|
||||
div = *a / *b;
|
||||
mod = *a % *b;
|
||||
*a = div;
|
||||
*b = mod;
|
||||
}
|
||||
|
||||
/* ////
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
|
||||
a = 10;
|
||||
b = 3;
|
||||
printf("a %d b %d\n", a, b);
|
||||
ft_ultimate_div_mod(&a, &b);
|
||||
printf("div %d mod %d\n", a, b);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putstr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/18 03:11:53 by tischmid #+# #+# */
|
||||
/* Updated: 2023/03/19 04:55:09 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_putstr(char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (str[i] != 0)
|
||||
write(1, &str[i++], 1);
|
||||
}
|
||||
|
||||
/* ////
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
ft_putstr("Hello World\n");
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strlen.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/19 04:52:42 by tischmid #+# #+# */
|
||||
/* Updated: 2023/03/19 05:08:06 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_strlen(char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (str[i] != '\0')
|
||||
++i;
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* ////
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("%d\n", ft_strlen("HELLO"));
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_rev_int_tab.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/19 05:26:52 by tischmid #+# #+# */
|
||||
/* Updated: 2023/03/19 05:35:16 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_rev_int_tab(int *tab, int size)
|
||||
{
|
||||
int i;
|
||||
int tmp;
|
||||
|
||||
i = -1;
|
||||
while (++i < size / 2)
|
||||
{
|
||||
tmp = tab[i];
|
||||
tab[i] = tab[size - i - 1];
|
||||
tab[size - i - 1] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* ////
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
int arrlen = 9;
|
||||
|
||||
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
i = -1;
|
||||
while (++i < arrlen)
|
||||
{
|
||||
printf("%d, ", arr[i]);
|
||||
}
|
||||
printf("<end>\n");
|
||||
ft_rev_int_tab(arr, arrlen);
|
||||
i = -1;
|
||||
while (++i < arrlen)
|
||||
{
|
||||
printf("%d, ", arr[i]);
|
||||
}
|
||||
printf("<end>\n");
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_sort_int_tab.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/19 05:36:28 by tischmid #+# #+# */
|
||||
/* Updated: 2023/03/19 05:56:18 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_sort_int_tab(int *tab, int size)
|
||||
{
|
||||
int i;
|
||||
int tmp;
|
||||
|
||||
while (--size >= -1)
|
||||
{
|
||||
i = -1;
|
||||
while (++i < size)
|
||||
{
|
||||
if (tab[i] > tab[i + 1])
|
||||
{
|
||||
tmp = tab[i];
|
||||
tab[i] = tab[i + 1];
|
||||
tab[i + 1] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ////
|
||||
#include <stdio.h>
|
||||
|
||||
void print_int_arr(int *arr, int arrlen)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = -1;
|
||||
while (++i < arrlen)
|
||||
{
|
||||
printf("%d, ", arr[i]);
|
||||
}
|
||||
printf("<end>\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int arrlen = 4;
|
||||
|
||||
int arr[] = {4, 3, 2, 1};
|
||||
print_int_arr(arr, arrlen);
|
||||
ft_sort_int_tab(arr, arrlen);
|
||||
print_int_arr(arr, arrlen);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
Loading…
Reference in New Issue