kske
/
linked-list
Archived
1
Fork 0

Removing of Elements

Added funtions to remove specific elements and to look at a certain magical index
This commit is contained in:
ertz4 2020-01-23 14:03:38 +01:00
parent 0c80e3372f
commit 55977d065a
1 changed files with 19 additions and 0 deletions

View File

@ -93,6 +93,23 @@ void show_print(Node** list)
list_print(*list, &book_print);
}
void show_get(Node** list)
{
int index;
printf("Enter place: ");
scanf_s(" %d", &index);
list_print(list_get(list,index), &book_print);
}
void show_remove(Node** list)
{
int index;
printf("Enter place: ");
scanf_s(" %d", &index);
list_remove(list_get(list, index));
}
void main(void)
{
Node* list = NULL;
@ -102,6 +119,8 @@ void main(void)
{"Append item", '2', (void*)&show_append, &list},
{"Insert item", '3', (void*)&show_insert, &list},
{"Print item", '4', (void*)&show_print, &list},
{"Look at item by index", '5', (void*)&show_get, &list},
{"Remove item by index", '6', (void*)&show_remove, &list},
{"BLANK", NULL, NULL, NULL},
{"Quit", 'q', (void*)&exit, NULL}
};