Removing of Elements
Added funtions to remove specific elements and to look at a certain magical index
This commit is contained in:
parent
0c80e3372f
commit
55977d065a
@ -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}
|
||||
};
|
||||
|
Reference in New Issue
Block a user