-
listProgramming 2005. 10. 8. 23:47먼저 list의 기본구조는 다음과 같다.
typedef struct list_node *list_pointer;
typedef struct list_node
{
datatype value_name;
list_node link;
}
list_pointer ptr=NULL;
하나의 데이터와 다음 node의 주소값을 가지는 가장 기본적인 노드의 형태이다.
그리고 C에서 추가적인 노드의 생성은 동적할당을 통하여 노드를 생성하여 연결시켜준다.
list_pointer create()
{
list_pointer first, second;
first=(list_pointer)malloc(sizeof(list_node));
second=(list_pointer)malloc(sizeof(list_node));
second->link=NULL;
second->data=value;
first->link=second;
first->data=value;
return first;
}'Programming' 카테고리의 다른 글
객체 지향 프로그래밍에서... (1) 2005.11.15 struct와 union (0) 2005.11.12 Access Modifier (0) 2005.10.11 Sorting (0) 2005.10.05 동적할당(C) (0) 2005.10.04