Commit | Line | Data |
---|---|---|
a5a96953 JB |
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) { | |
a5a96953 | 20 | printf("--Begin--\n"); |
761e3496 | 21 | for (unsigned i = 0, length = list_count(head); i < length; i++) { |
19861555 | 22 | printf("value at [%d]=%d\n", i, list_get(head, i)); |
a5a96953 JB |
23 | } |
24 | printf("--End--\n"); | |
25 | } |