diff --git a/slides/cours_21.md b/slides/cours_21.md index 18e4d0d6fe65acf0db5b884ad30c5f3e927d433a..297700adf39533e656fd353a890312056383fd62 100644 --- a/slides/cours_21.md +++ b/slides/cours_21.md @@ -197,11 +197,12 @@ arbre creer_arbre(prof) ```C node *qt_create(int depth) { + if (depth <= 0) { + return NULL; + } node *n = calloc(1, sizeof(node)); - if (depth > 0) { - for (int i = 0; i < 4; ++i) { - n->child[i] = qt_create(depth-1); - } + for (int i = 0; i < 4; ++i) { + n->child[i] = qt_create(depth-1); } return n; }