연습
void_linked_list -연습-
JunkMam
2015. 6. 3. 22:46
linked_list을 void형으로 처리하는 방법.
void로 데이터를 저장하고, 해당 데이터의 크기를 v_size을 이용 할 수 있다.
next를 이용해서 다음 값을 받아질 수 있게한다.
void_list 구조
1 2 3 4 5 | struct _void_node{ char v_size; void* dats; struct _void_node* next; } | cs |
void_List.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** */ struct _void_node{ char v_size; void* dats; struct _void_node* next; }; /** */ int mk_list(struct _void_node**); int addFront(struct _void_node**, void*, char); int delFtont(struct _void_node**, void*); | cs |
void_List.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /** */ #include "voidList.h" /** */ int mk_list(struct _void_node** lp){ printf("Test %d\n",*lp); struct _void_node* tmplp = (struct _void_node*)NULL; if(*lp!=NULL){ printf("Error lp is Not NULL."); return 1; } tmplp = (struct _void_node*)malloc(sizeof(struct _void_node)); *lp = tmplp; } /** */ int addFront(struct _void_node** lp, void* dats, char v_size){ } /** */ int delFtont(struct _void_node** lp, void* dats){ } | cs |
현재, List을 연결하여 처리하는 것에 대해서 이상 유무를 처리하고 있다.