【专业技术】如何写出优美的C 代码? - 腾讯云开发者社区-腾讯云

PHOTO EMBED

Tue Dec 06 2022 06:10:58 GMT+0000 (Coordinated Universal Time)

Saved by @leawoliu #javascript

#ifndef _ILIST_H 
 #define     _ILIST_H 
 
 // 定义链表中的节点结构
 typedef struct node{ 
    void *data; 
    struct node *next; 
 }Node; 
 
 // 定义链表结构
 typedef struct list{ 
    struct list *_this; 
    Node *head; 
    int size; 
    void (*insert)(void *node);// 函数指针
    void (*drop)(void *node); 
    void (*clear)(); 
    int (*getSize)(); 
    void* (*get)(int index); 
    void (*print)(); 
 }List; 
 
 void insert(void *node); 
 void drop(void *node); 
 void clear(); 
 int getSize(); 
 void* get(int index); 
 void print(); 
 
 #endif      /* _ILIST_H */
content_copyCOPY

定义链表

https://cloud.tencent.com/developer/article/1062995