代码实现:
#include <stdio.h>
#include<stdlib.h>
#include<string.h>
struct StackRecord
{
int Capacity;//最多入栈元素个数
int TopOfStack;//栈顶
char *Array;//栈元素
};
typedef struct StackRecord *Stack;
Stack CreateStack(int MaxElem)
{
Stack S;
S=(StackRecord *)malloc(sizeof(struct StackRecord));
if(S==NULL)
printf("Out of space!1");
S->Array=(char *)malloc(sizeo