Instructions Difficile
Inverser un tableau
Tableaux · Exercice 6
Écris une fonction qui inverse un tableau sur place (sans créer un nouveau tableau).
int tab[] = {1, 2, 3, 4, 5};
inverser(tab, 5);
// tab contient maintenant {5, 4, 3, 2, 1}
Indice : échange les éléments symétriques (utilise une variable temporaire comme au chapitre ch:pointeurs).
ÉDITEUR GCC 14.2 -Wall -Wextra -std=c17
Snippets :
SORTIE
Appuie sur Ctrl+Entrée pour compiler et exécuter.