diff --git a/list.c b/list.c index d7db1e8..42f2c3e 100644 --- a/list.c +++ b/list.c @@ -8,4 +8,32 @@ typedef struct Node { struct List { Node *head; -}; \ No newline at end of file +}; + +bool isEmpty(List* list) { + return list->head == NULL; +} + +int clear(List* list) { + while (!isEmpty(list)) { + int errorCode = 0; + delete(list, &errorCode); + } +} + +int changeNode(List* list, int position, int value) { + if (isEmpty(list)) { + return -1; + } + + Node* walker = list->head; + while (walker->position != position) { + if (walker->next == NULL) { + return -1; + } + walker = walker->next; + } + + walker->value = value; + return 0; +} \ No newline at end of file