+ /* error might have occured */
+ handle_prompt_error(errno);
+ return array;
+}
+
+void display_choice_menu() {
+ printf("\n=== Menu ===\n\n");
+ printf("1) Saisir puis concatener un autre tableau.\n");
+ printf("2) Trier le tableau.\n");
+ printf("3) Afficher le tableau.\n");
+ printf("4) Compter le nombre d'occurence d'un entier dans le tableau.\n");
+ printf("5) Quitter.\n");
+}
+
+int* do_concat(int array[], unsigned* size) {
+ int* tab_to_concat = NULL;
+ unsigned tab_to_concat_size = 0;
+ printf("\n=== Saisie d'un tableau ===\n\n");
+ tab_to_concat = prompt_array(tab_to_concat, &tab_to_concat_size);
+ int* tab_concat = concat_tab(array, *size, tab_to_concat, tab_to_concat_size);
+ *size += tab_to_concat_size;
+ free_tab(array);
+ free_tab(tab_to_concat);
+ return tab_concat;
+}
+
+void do_sort(int array[], unsigned size) {
+ int errno = 0;
+ int choice = 0;
+ bool done = false;
+ criteria_cb criteria;
+
+ printf("\n=== Menu de tri ===\n\n");
+ printf("1) Croissant.\n");
+ printf("2) Decroissant.\n");
+ printf("3) Croissant pairs en premier.\n");
+ printf("4) Croissant impairs en premier.\n");
+ do {
+ errno = prompt_value("Choix?", &choice);
+ handle_prompt_error(errno);
+ done = true;
+ if (1 > choice || 4 < choice) {
+ printf("\nFaire un choix compris entre 1 et 4\n");
+ done = false;
+ }
+ } while (!done);
+ switch (choice) {
+ case 1:
+ criteria = ascending;
+ break;
+ case 2:
+ criteria = descending;
+ break;
+ case 3:
+ criteria = ascending_and_even;
+ break;
+ case 4:
+ criteria = ascending_and_odd;
+ break;
+ default:
+ criteria = ascending;
+ break;