diff --git a/serie1/ex1/.gitignore b/serie1/ex1/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..cccd7230993bed369513a1e3225d6c45ae40dca7 --- /dev/null +++ b/serie1/ex1/.gitignore @@ -0,0 +1,3 @@ +*.o +prog +*.xopp diff --git a/serie1/ex1/Makefile b/serie1/ex1/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b8cbbd64136ccba9baf2dfecabde09143c7042e8 --- /dev/null +++ b/serie1/ex1/Makefile @@ -0,0 +1,19 @@ +CC := clang +CFLAGS := -g -pedantic -Wall -Wextra -std=c2x +LDFLAGS := -fsanitize=address -fsanitize=leak -fsanitize=undefined -lm +TARGET := prog + +all: $(TARGET) + +$(TARGET): prog.o + @printf "=================== Building executable ===================\n" + $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) + @printf "\n" + +%.o: %.c + @printf "================== Building object files ==================\n" + $(CC) $(CFLAGS) -c $< + @printf "\n" + +clean: + rm -f *.o $(TARGET) diff --git a/serie1/ex1/pco_serie1_ex1_2023-09-24-Note-12-16.pdf b/serie1/ex1/pco_serie1_ex1_2023-09-24-Note-12-16.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b27d67343b47c79d3f35582835b718922d0b084f Binary files /dev/null and b/serie1/ex1/pco_serie1_ex1_2023-09-24-Note-12-16.pdf differ diff --git a/serie1/ex1/prog.c b/serie1/ex1/prog.c new file mode 100644 index 0000000000000000000000000000000000000000..c995bf607f1b729fc191deb3cc64a1b9547d1d56 --- /dev/null +++ b/serie1/ex1/prog.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#include <stdlib.h> + +int main(void) { + long n = 15; + long *p = &n; + long **pp = &p; + + fprintf(stdout, "Value of n: %ld\tValue of *p: %ld\t Value of **p: %ld\n", + n, *p, **pp); + + return EXIT_SUCCESS; +}