#include <Turboc.h>

 

// 노드 구조체

struct Node

{

     int value;

     Node *next;

};

Node *head;

 

// 연결 리스트 초기화 - 머리를 할당한다.

void InitList()

{

     head=(Node *)malloc(sizeof(Node));

     head->next=NULL;

}

 

// Target 다음에 노드를 삽입한다.

Node *InsertNode(Node *Target,Node *aNode)

{

     Node *New;

 

     New=(Node *)malloc(sizeof(Node));

     *New=*aNode;

 

     New->next=Target->next;

     Target->next=New;

     return New;

}

 

// Target 다음 노드를 삭제한다.

BOOL DeleteNode(Node *Target)

{

     Node *Del;

 

     Del=Target->next;

     if (Del==NULL) {

          return FALSE;

     }

     Target->next=Del->next;

     free(Del);

     return TRUE;

}

 

// 연결 리스트의 모든 노드와 머리를 해제한다.

void UnInitList()

{

     while (DeleteNode(head)) {;}

 

     free(head);

     head=NULL;

}

 

void main()

{

     int i;

     Node *Now,Temp;

 

     InitList();

 

     // 다섯 개의 노드 삽입

     Now=head;

     for (i=1;i<=5;i++) {

          Temp.value=i;

          Now=InsertNode(Now,&Temp);

     }

 

     // 두 번째 노드 삭제

     DeleteNode(head->next);

 

     // 순회하면서 출력

     for (Now=head->next;Now;Now=Now->next) {

          printf("%d\t",Now->value);

     }

     printf("\n");

 

     UnInitList();

}


----------------------------------------------------------


이건데


Node *InsertNode(Node *Target,Node *aNode)

{

     Node *New;

 

     New=(Node *)malloc(sizeof(Node));

     *New=*aNode;

 

     New->next=Target->next;

     Target->next=New;

     return New;

}


New->next=Target->next; 이게 의미 하는게 머죠? 해석을 어떻게 해야될지모르겟음. 자세하게 알려주실분.