在数据结构中,栈是一种桶状结构,每次往桶里放数据,最后放的数据最先被拿出来,最先放进去的数据最后才能出来(FILO)

一、文件清单:

数据结构-栈 C和C++的实现

MyStack.h:

#ifndef _MYSTACK_H
#define _MYSTACK_H
#include <stdio.h>
#include <stdlib.h>


typedef unsigned char bool;
#define true 1;
#define false 0;


typedef int Elem;
typedef struct mystack
{
    int iMaxSize;
    int iLength;
    Elem *Datas;
}MyStack;

extern bool Stack_Init(MyStack* stack,int size);
extern bool Stack_Delete(MyStack *stack);
extern bool isStackEmpty(MyStack *stack);
extern bool isStackFull(MyStack *stack);
extern int Stack_size(MyStack *stack);
extern bool Stack_push(MyStack *stack,Elem data);
extern bool Stack_top(MyStack *stack,Elem *container);
extern bool Stack_bottom(MyStack *stack,Elem *container);
extern bool Stack_pop(MyStack *stack);
extern void Stack_printf(MyStack *stack);



#endif

 
View Code

相关文章: