- 顺序表结构体定义请参考:https://www.cnblogs.com/kxwslmsps/p/16937235.html
- 清空顺序表
/** * @brief 功能:清空顺序表--将当前表长度置0 \n * @param[in] plist:表结构指针 */ void sList_clear(mySList* plist) { if (plist == NULL || plist->pbase == NULL) { return; } plist->size = 0; }
- 销毁顺序表
/** * @brief 功能:销毁顺序表--释放堆上表元素空间,表成员置空或0 \n * @param[in] plist:表结构指针 */ void sList_destroy(mySList* plist) { if (plist == NULL || plist->pbase == NULL) { return; } free(plist->pbase); plist->pbase = NULL; plist->capacity = 0; plist->size = 0; }