Preview:
Node *node = NULL; 
List *list = NULL; 
 
void insert(void *node); 
void drop(void *node); 
void clear(); 
int getSize(); 
void print(); 
void* get(int index); 
 
List *ListConstruction(){ 
   list = (List*)malloc(sizeof(List)); 
   node = (Node*)malloc(sizeof(Node)); 
   list->head = node; 
   list->insert = insert;// 将 insert 函数实现注册在 list 实体上
   list->drop = drop; 
   list->clear = clear; 
   list->size = 0; 
   list->getSize = getSize; 
   list->get = get; 
   list->print = print; 
   list->_this = list;// 用 _this 指针将 list 本身保存起来
 
   return (List*)list; 
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter