题目描述:
栈的实现及栈的基本操作:
#include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
#include<cstring>
#define max 50;
typedef char type;
typedef struct
{
type data[50];
int top;
}stack;
void initialstack(stack *s)
{
s->top = 0;
}
int push(stack *s, type x)
{
if (s->top == 50)
return -1;
s->data[s->top++] = x;
return 0;
}
type pop(stack *s)
{
if (s->top == 0)
return -2;
type x = s->data[--s->top];
return x;
}
题目解答:
利用栈实现递归函数的非递归计算下载