/* LinkList Implements a Link list insertion sort. LinkList structure defs in LinkList.h */ #include "LinkList.h" #define NMax 2 main(){ LLNode CNode, INode; LL LLTest; int i,m; // manually setting a node CNode.value = 12; CNode.up = NULL; CNode.down = NULL; // Add first node to list m = 10; LLTest.LL = (LLNode *)malloc(m*sizeof(LLNode)); // *(LLTest.LL) = TestNode; // or // LLTest.LL = &TestNode; LLTest.LL = &CNode; LLTest.m=1; // Add a new node to the list // Find Correct Position INode.value=14; // Search for Insert Point CNode = *(LLTest.LL); while(CNode.value > INode.value && CNode.up!=NULL){ CNode = *(CNode.up); } // Insert Node // Needs a template InsertNode(CNode, *(CNode.up), INode, LL); // Needs to update counter in LL and fix the pointers // in CNode and CNode.up. It looks like this cause // I want to use the same code for the down one. };