--- /dev/null
+*.o
+
+# editor trash
+*.swp
+*.~
+
+thumbs.db
--- /dev/null
+Introduction:
+-------------
+
+The whole purpose of the current C code is to solve the
+Polytech'Marseille C tutorial exercices.
+
+The repositories organisation is pretty straightforward:
+-> exo? where ? is a digit is the repository where lies the
+solution to exercice one, and so on.
+
+Building the solutions:
+-----------------------
+
+ cd exo1 && make
+ cd exo2 && make
+ cd exo3 && make
+
+Cleaning the solutions:
+-----------------------
+
+ cd exo1 && make clean
+ cd exo2 && make clean
+ cd exo3 && make clean
+
+Running the solutions:
+----------------------
+
+ cd exo1 && ./exo1
+ cd exo2 && ./exo2
+ cd exo3 && ./exo3
+
+Exercice skeleton:
+------------------
+
+It's the directory exo_skel with a basic Makefile inside
+
+To use it:
+ cp -a exo_skel exo# where # is a digit
+ cd exo# && cp exo_skel.c exo#
+ edit the Makefile to change the TARGET variable to the
+ exercice name desired
--- /dev/null
+TARGET = exo1
+LIBS =
+CC = gcc
+# Enforce C11 ISO standard for now
+CFLAGS = -std=c11 -g -Wall
+LDFLAGS = -g -Wall
+
+.PHONY: default all clean
+
+default: $(TARGET)
+all: default
+
+OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
+HEADERS = $(wildcard *.h)
+
+%.o: %.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+.PRECIOUS: $(TARGET) $(OBJECTS)
+
+$(TARGET): $(OBJECTS)
+ $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
+
+clean:
+ -rm -f $(TARGET) $(OBJECTS)
+
+disassemble: $(TARGET)
+ objdump -d $< | less
+
+symbols: $(TARGET)
+ objdump -t $< | sort | less
--- /dev/null
+#include <stdio.h>
+#include <stdbool.h>
+
+
+void promptValue(const char* msg, int* addr) {
+ puts(msg);
+ scanf("%d", addr);
+}
+
+void xorSwap (int *v1, int *v2) {
+ if (v1 != v2) {
+ *v1 ^= *v2;
+ *v2 ^= *v1;
+ *v1 ^= *v2;
+ }
+}
+
+void swap(int* v1, int* v2) {
+ int tmp = *v1;
+ if (v1 != v2) {
+ *v1 = *v2;
+ *v2 = tmp;
+ }
+}
+
+void displayArray(int* array, int count) {
+ for (int i = 0; i < count; i++) {
+ printf("Value in array index %d = %d\n", i, array[i]);
+ }
+}
+
+bool sortFirst(int* array, int length) {
+ for (int i = 0; i < length-1; i++) {
+ if (array[i] > array[i+1]) {
+ swap(&array[i], &array[i+1]);
+ return true;
+ }
+ }
+ return false;
+}
+
+int main() {
+ int array[5];
+ for (int i = 0; i < 5; i++) {
+ promptValue("Valeur ?", &array[i]);
+ }
+ displayArray(array, 5);
+
+ return 0;
+}
--- /dev/null
+TARGET = exo_skel
+LIBS =
+CC = gcc
+# Enforce C11 ISO standard for now
+CFLAGS = -std=c11 -g -Wall
+LDFLAGS = -g -Wall
+
+.PHONY: default all clean
+
+default: $(TARGET)
+all: default
+
+OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
+HEADERS = $(wildcard *.h)
+
+%.o: %.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+.PRECIOUS: $(TARGET) $(OBJECTS)
+
+$(TARGET): $(OBJECTS)
+ $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
+
+clean:
+ -rm -f $(TARGET) $(OBJECTS)
+
+disassemble: $(TARGET)
+ objdump -d $< | less
+
+symbols: $(TARGET)
+ objdump -t $< | sort | less
--- /dev/null
+#include <stdio.h>
+
+int main() {
+
+ return 0;
+}