/*****************************************************************
栈实现的简单计算器
*****************************************************************/
#include<stdio.h>
#include<stdlib.h>
#define OK 1
#define ERROR 0
typedef char StackData;
typedef int StackData_cal;
typedef struct node //字符结点
{
StackData data; //结点数据
struct node * next; //结点链指针
} StackNode;
typedef struct node_cal //整数结点
{
StackData_cal data; //结点数据
struct node_cal * next; //结点链指针
} StackNode_cal;
//**********************************************************
StackNode * InitStack(void)
{
StackNode *top;
top=NULL;
return (top);
}
int Push ( StackNode **top, StackData x )
{
StackNode *p =(StackNode*)malloc(sizeof(StackNode));
if(top==NULL)
{
*top=p;
p->data = x;
p-&