From 747284dd53a82ed9dfb0392c4874e863556c2417 Mon Sep 17 00:00:00 2001
From: Orestis <orestis.malaspinas@pm.me>
Date: Wed, 23 Feb 2022 07:56:20 +0100
Subject: [PATCH] minor update

---
 slides/genericite.md | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/slides/genericite.md b/slides/genericite.md
index 6e7d5f4..29d9c3e 100644
--- a/slides/genericite.md
+++ b/slides/genericite.md
@@ -47,6 +47,41 @@ date: "2022-02-22"
     ```
 * À la programmeuse de faire attention à ce qu'elle fait.
 
+## Exemple
+
+```C 
+struct tab {
+    int *t;
+}
+struct tab *tmp = malloc();
+tmp->t = malloc();
+free(tmp); // memory leak of tmp->t...
+```
+
+# Exemple simple
+
+* On souhaite échanger deux pointeurs
+
+    ```C 
+    int *a = malloc();
+    int *b = malloc();
+    swap(&a, &b);
+    ```
+* Comment écrire `swap()` pour que le code ci-dessus marche pour n'importe quel
+  type?
+
+. . .
+
+```C 
+void swap(void **a, void **b) {
+    void *tmp = *a;
+    *a = *b;
+    *b = tmp;
+}
+```
+
+
+
 # Cas d'utilisation (1/4)
 
 \footnotesize
-- 
GitLab