#include <stdio.h>
#include <LKlist.h>
#include "main.h"

int main( int argc, char *argv[] )
{
    listptr    mylist;
    position    list_index;
    ADDRESS    person;

    // Create a new linked list
    LKCreateList(&mylist, sizeof(person));
 

    // Load the data structure
    sprintf(person.name, "%s", "Herman Munster");
    sprintf(person.address, "%s", "1313 Mockingbird Ln");
    sprintf(person.city, "%s", "Sleepyhollow");
    sprintf(person.state, "%s", "Virginia");
    person.zip = 77777;
 

    // Insert the data into the linked list
    LKInsertAfterInList(mylist, LKLastInList(mylist), &person);
 

    //  Update data structure
    sprintf(person.name, "%s", "Lilly Munster");
 

    // Get the current position of the linked list and update that data record
    list_index = LKCurrent(mylist);
    LKPutInList(mylist, list_index, &person);
 

    // Destroy the linked list
    LKZapList(mylist);

    return(0);
}