Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[C language data structure] sequential stack

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

SeqStack.h

# ifndef SEQSTACK_H#define SEQSTACK_Htypedef void SeqStack;SeqStack* SeqStack_Create (int capacity); void SeqStack_Destroy (SeqStack* stack); void SeqStack_Clear (SeqStack* stack); int SeqStack_Push (SeqStack* stack, void* item); void* SeqStack_Pop (SeqStack* stack); void* SeqStack_Top (SeqStack* stack); int SeqStack_Size (SeqStack* stack); int SeqStack_Capacity (SeqStack* stack); # endif / / SEQSTACK_H

SeqStack.c

# include "SeqStack.h" # include "SeqList.h" SeqStack* SeqStack_Create (int capacity) {return SeqList_Create (capacity);} void SeqStack_Destroy (SeqStack* stack) {SeqList_Destroy (stack);} void SeqStack_Clear (SeqStack* stack) {SeqList_Clear (stack);} int SeqStack_Push (SeqStack* stack, void* item) {return SeqList_Insert (stack,item,SeqList_Length (stack)) } void* SeqStack_Pop (SeqStack* stack) {return SeqList_Remove (stack,SeqList_Length (stack)-1);} void* SeqStack_Top (SeqStack* stack) {return SeqList_Get (stack,SeqList_Length (stack)-1);} int SeqStack_Size (SeqStack* stack) {return SeqList_Length (stack);} int SeqStack_Capacity (SeqStack* stack) {return SeqList_Capacity (stack);}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report