#include <stdlib.h>
#include <stdio.h>

typedef int data_type ;

struct node_type
{
    struct node_type* next ;
    data_type data ;
};

typedef struct list_type
{
    struct node_type* head ;
} List ;

List List_Create()
{
    List list = { NULL } ;
    return list ;
}

int List_AddItem(List* list, data_type item)
{
    struct node_type* newNode = malloc(sizeof(struct node_type)) ;

    if ( newNode )
    {
        newNode->data = item ;
        newNode->next = list->head ;
        list->head = newNode ;
        return 1 ;
    }

    return 0 ;
}

void List_Destroy(List* list)
{
    struct node_type* curNode = list->head ;

    while ( curNode )
    {
        list->head = curNode->next ;
        free(curNode) ;
        curNode = list->head ;
    }
}

void List_Print(const List* list)
{
    const struct node_type* curNode = list->head ;

    while ( curNode )
    {
        printf( "%d\n", curNode->data) ;
        curNode = curNode->next ;
    }
}

int main()
{
    List list = List_Create() ;

    for ( int i=0; i<10; ++i )
        List_AddItem(&list, i);

    List_Print(&list) ;
    List_Destroy(&list) ;
}