TP 13 exo1: Add libraries functions already written
[TD_C.git] / TP_13 / exo1 / lib / utils.c
diff --git a/TP_13/exo1/lib/utils.c b/TP_13/exo1/lib/utils.c
new file mode 100644 (file)
index 0000000..c48206f
--- /dev/null
@@ -0,0 +1,13 @@
+#include "utils.h"
+
+void swap_int_ptr(int* v1, int* v2) {
+    int tmp = *v1;
+    *v1 = *v2;
+    *v2 = tmp;
+}
+
+void swap_ptr(void* v1, void* v2) {
+    void* tmp = v1;
+    v1 = v2;
+    v2 = tmp;
+}