//片方向リストと末尾に追加する関数

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

//ノードの定義
typedef struct list_tag
{
    int val;
    struct list_tag *next;
} LIST;

//リスト初期化
void list_initialize(LIST **head)
{
    *head=NULL;
}

//リストの末尾に追加
void list_push_back(LIST **head, int val)
{
    LIST *pos;
    LIST *prev;
    LIST *new_list;

    new_list=malloc(sizeof(LIST));
    new_list->val=val;

    if (*head==NULL)
    {
        new_list->next=NULL;
        *head=new_list;