// Linked list with integer values #include "ilist.h" // Testing interface - get values from command line, display, delete last 2 int main(int argc, char *argv[]) { if (argc < 3) { fprintf(stderr,"Usage: %s n1 n2 ... nk d1 d2\n", argv[0]); return -1; } IntNode ilist; listInitialize(&ilist); for (int i = 1; i < argc - 2; ++i) { listAppend(&ilist, atoi(argv[i])); } listDisplay(&ilist); int d1 = atoi(argv[argc - 2]); listRemove(&ilist, d1); printf("After deleting the value %d, the list is\n", d1); listDisplay(&ilist); listInsertBefore(&ilist, 99, 0); printf("Inserted 99 at position 0\n"); listInsertBefore(&ilist, 999, 4); printf("Inserted 999 at position 4\n"); listInsertBefore(&ilist, 9999, 13); printf("Inserted 999 at position 13\n"); listDisplay(&ilist); int d2 = atoi(argv[argc - 1]); listRemove(&ilist, d2); printf("After deleting the value %d, the list is\n", d2); listDisplay(&ilist); listCleanup(&ilist); }