TP11: Rename the static binary target to express that it's not
[TD_C.git] / TP_11 / exo2 / ui.c
1 #include <stdio.h>
2
3 #include "ui.h"
4
5 int promptValue(const char* msg, int* result) {
6 puts(msg);
7 int retVal = scanf("%d", result);
8 return (retVal == 1) ? 0 : 1;
9 }
10
11 void displayArray(const int array[], unsigned length) {
12 printf("--Begin--\n");
13 for (unsigned i = 0; i < length; i++) {
14 printf("array[%d]=%d\n", i, array[i]);
15 }
16 printf("--End--\n");
17 }
18
19 void displayList(link_t* head) {
20 unsigned i = 0;
21
22 printf("--Begin--\n");
23 while (head != NULL) {
24 printf("value at [%d]=%d\n", i, head->value);
25 head = head->next;
26 i++;
27 }
28 printf("--End--\n");
29 }