X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_11%2Fexo2%2Fui.c;fp=TP_11%2Fexo2%2Fui.c;h=998b8469cb4a45fbb503e8ca895b1b0d49e508fd;hb=a5a969535fd998039f26ddab023a0a7153006d81;hp=0000000000000000000000000000000000000000;hpb=3bb0a9f80ebc5b3d7c05c78cbf65241c6a6b0490;p=TD_C.git diff --git a/TP_11/exo2/ui.c b/TP_11/exo2/ui.c new file mode 100644 index 0000000..998b846 --- /dev/null +++ b/TP_11/exo2/ui.c @@ -0,0 +1,29 @@ +#include + +#include "ui.h" + +int promptValue(const char* msg, int* result) { + puts(msg); + int retVal = scanf("%d", result); + return (retVal == 1) ? 0 : 1; +} + +void displayArray(const int array[], unsigned length) { + printf("--Begin--\n"); + for (unsigned i = 0; i < length; i++) { + printf("array[%d]=%d\n", i, array[i]); + } + printf("--End--\n"); +} + +void displayList(link_t* head) { + unsigned i = 0; + + printf("--Begin--\n"); + while (head != NULL) { + printf("value at [%d]=%d\n", i, head->value); + head = head->next; + i++; + } + printf("--End--\n"); +}