//linkedListTest.c //Author: John T. Rine //Date: October 5, 2011 #include "linkedListLib.h" int main(int argc, char **argv) { node *head, *tail, *copyHead, *copyTail, *temp; head = tail = copyHead = copyTail = NULL; int i = 1; printf("Creating a list of 4 nodes...\n"); createList(&head, &tail, 4); printf("Size of the list is: %d\n", listSizeHead(head)); printf("Load list data\n"); loadListData(head); printIntDataHead(head); printf("Inserting node 0 with data of 3200 before head node...\n"); insert(&head, &tail, 0, 3200); printf("Size of the list is: %d\n", listSizeHead(head)); printIntDataHead(head); printf("Inserting node with data of -3200 before tail node...\n"); insert(&head, &tail, listSizeHead(head) - 1, -3200); printf("Size of the list is: %d\n", listSizeHead(head)); printIntDataHead(head); printf("Appending node with data of 2300 after head node...\n"); append(&head, &tail, 0, 2300); printf("Size of the list is: %d\n", listSizeHead(head)); printIntDataHead(head); printf("Appending node with data of -2300 after tail node...\n"); append(&head, &tail, listSizeHead(head) - 1, -2300); printf("Size of the list is: %d\n", listSizeHead(head)); printIntDataHead(head); printf("Loading node 0 with data of 0...\n"); loadNode(head, 0, 0); printf("Size of the list is: %d\n", listSizeHead(head)); printIntDataHead(head); printf("Loading tail node with data of 255...\n"); loadNode(head, listSizeHead(head) - 1, 255); printf("Size of the list is: %d\n", listSizeHead(head)); printIntDataHead(head); printf("Deleting head node...\n"); deleteNode(&head, &tail, 0); printf("Size of the list is: %d\n", listSizeHead(head)); printIntDataHead(head); printf("Deleting tail node...\n"); deleteNode(&head, &tail, listSizeHead(head) - 1); printf("Size of the list is: %d\n", listSizeHead(head)); printIntDataHead(head); printf("Deleting node 2...\n"); deleteNode(&head, &tail, 2); printf("Size of the list is: %d\n", listSizeHead(head)); printIntDataHead(head); copyList(head, ©Head, ©Tail); printf("Size of the list is: %d\n", listSizeHead(copyHead)); printIntDataHead(copyHead); printf("The node location of 3 is %d\n", findData(copyHead, 3)); destroyListHead(head); getchar(); //Holds the console window open on a Windows machine }