TP 13 exo1: create an array in the main()
[TD_C.git] / TP_11 / exo2 / lib / ui.c
... / ...
CommitLineData
1#include <stdio.h>
2
3#include "ui.h"
4
5int promptValue(const char* msg, int* result) {
6 puts(msg);
7 int retVal = scanf("%d", result);
8 return (retVal == 1) ? 0 : 1;
9}
10
11void 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
19void displayList(link_t* head) {
20 printf("--Begin--\n");
21 for (unsigned i = 0, length = list_count(head); i < length; i++) {
22 printf("value at [%d]=%d\n", i, list_get(head, i));
23 }
24 printf("--End--\n");
25}