From 2b648f9c692bf0b97da3dd5e72baf47abe028040 Mon Sep 17 00:00:00 2001 From: "dario.genga" <dario.genga@etu.hesge.ch> Date: Tue, 16 Nov 2021 13:31:58 +0100 Subject: [PATCH] Add base of the project This include : - .gitignore - README - makefile - Files (main, .c, .h) --- .gitignore | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 18 ++++++++++-- main.c | 16 +++++++++++ makefile | 12 ++++++++ matrix.c | 14 ++++++++++ matrix.h | 12 ++++++++ 6 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 main.c create mode 100644 makefile create mode 100644 matrix.c create mode 100644 matrix.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..359f762 --- /dev/null +++ b/.gitignore @@ -0,0 +1,81 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/c,visualstudiocode +# Edit at https://www.toptal.com/developers/gitignore?templates=c,visualstudiocode + +### C ### +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# Support for Project snippet scope +!.vscode/*.code-snippets + +# End of https://www.toptal.com/developers/gitignore/api/c,visualstudiocode + +# Custom gitignore for project +matrix \ No newline at end of file diff --git a/README.md b/README.md index ced88a4..ef214cb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ -# progseq-matrix +# Matrices -7e travail pratique du cours de programmation séquentielle, 1er année (2021-2022). +- **Class** : Programmation séquentielle en C +- **Creation date** : 16 novembre 2021 +- **Description** : 7e travail pratique -Matrices \ No newline at end of file +## Makefile configuration + +### Compile the project +> `make` + +Use this command to compile the project. + +### Clean the project +> `make clean` + +Use this command to clean the project. diff --git a/main.c b/main.c new file mode 100644 index 0000000..b524a78 --- /dev/null +++ b/main.c @@ -0,0 +1,16 @@ +/* Author : Dario GENGA + * Date : 13.10.2021 + * Description : Template for a standard c file + */ + +#include <stdio.h> +#include <stdlib.h> +// #include <math.h> +// #include <time.h> +#include "matrix.h" + +int main() { + printf("Hello world!"); + + return EXIT_SUCCESS; +} diff --git a/makefile b/makefile new file mode 100644 index 0000000..30b4034 --- /dev/null +++ b/makefile @@ -0,0 +1,12 @@ +LIB=-lm +CC=gcc -Wall -Wextra -g + +matrix:matrix.o main.o + gcc $^ -fsanitize=address -o $@ $(LIB) + +matrix.o: matrix.c matrix.h + $(CC) -c $< $(LIB) +main.o: main.c + $(CC) -c $< $(LIB) +clean: + rm -f *.o matrix \ No newline at end of file diff --git a/matrix.c b/matrix.c new file mode 100644 index 0000000..920e761 --- /dev/null +++ b/matrix.c @@ -0,0 +1,14 @@ +/* Author : Dario GENGA + * Date : 15.11.2021 + * Description : Manipulate an unidimensional array with dynamic memory allocation + */ + +#include "matrix.h" +#include <stdio.h> + +void swap(int *x, int *y) +{ + int tmp = *x; + *x = *y; + *y = tmp; +} diff --git a/matrix.h b/matrix.h new file mode 100644 index 0000000..ee830b6 --- /dev/null +++ b/matrix.h @@ -0,0 +1,12 @@ +/* Author : Dario GENGA + * Date : 15.11.2021 + * Description : Manipulate an unidimensional array with dynamic memory allocation + */ +#ifndef _MATRIX_H +#define _MATRIX_H +#include <stdio.h> +#include <stdlib.h> + +void swap(int *x, int *y); + +#endif \ No newline at end of file -- GitLab