add c01/ex0{1,2}

This commit is contained in:
Aleksei Chubukov 2023-11-22 19:59:54 +04:00
parent 6a49d7c807
commit de6099c26d
3 changed files with 32 additions and 1 deletions

View File

@ -18,7 +18,7 @@ clean:
build/c%: $(OFFSHORE_PROJECTS)/c$$(subst _,+,$$*)/*.c $$(OFFSHORE_MAINS)/c$$*.c
mkdir -p $(@D)
$(CC) -o $@ $(CFLAGS_MANDATORY) $(CFLAGS) $^
norme: $$(foreach c, 00 01, $(OFFSHORE_PROJECTS)/c$$c)
norme: $$(wildcard $(OFFSHORE_PROJECTS)/c*)
norminette -R CheckForbiddenSourceHeader $^
.PHONY: all norme clean

20
c01/ex01.c Normal file
View File

@ -0,0 +1,20 @@
#include <stdio.h>
void ft_ultimate_ft(int *********nbr);
int main(void)
{
int n = -666;
int *j1 = &n;
int **j2 = &j1;
int ***j3 = &j2;
int ****j4 = &j3;
int *****j5 = &j4;
int ******j6 = &j5;
int *******j7 = &j6;
int ********j8 = &j7;
int *********johnny = &j8;
printf("was %d\n", n);
ft_ultimate_ft(johnny);
printf("now %d\n", n);
}

11
c01/ex02.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
void ft_swap(int *a, int *b);
int main(void)
{
int one = 1;
int two = 2;
printf("was %d %d\n", one, two);
ft_swap(&one, &two);
printf("now %d %d\n", one, two);
}