Code:
typedef struct NodeT
{
struct NodeT *L, *R;
char info;
} NodeT;
typedef struct
{
NodeT * array[80];
int tos;
} StackT;
typedef struct
{
char iArray[81];
int current;
} Input;
NodeT getCharacter(Input *);
NodeT peekCharacter(Input *);
void pushStack(StackT *, NodeT *);
NodeT * popStack(StackT *);
NodeT * combine(NodeT *, NodeT *, NodeT *);
NodeT * peekStack(StackT *);
void initStack(StackT *);
void initInput(Input *);
NodeT newNode(char);
void printPrefix(NodeT *);
void printInfix(NodeT *);
void printPostfix(NodeT *);
void displayStack(StackT *);
int getAction(char, NodeT *, int[][5]);
int getRow(char);
int getCol(NodeT *);
int main()
{
Input iList;
StackT OperatorStack;
StackT OperandStack;
initStack(&OperatorStack);
initStack(&OperandStack);
initInput(&iList);
int table[8][5] = {1,1,1,1,5,
4,4,2,2,5,
2,4,2,2,5,
2,2,2,2,5,
4,4,3,5,5,
6,6,6,6,5,
7,7,7,7,5,
5,5,5,5,5};
fprintf(stderr, "%c", OperatorStack.array[OperatorStack.tos]);
return 0;
}
void initStack(StackT *stack)
{
stack->tos = 0;
}
void initInput(Input *i)
{
i->current = 0;
fprintf(stderr, "Please enter an infix expression: ");
scanf("%s", i->iArray);
}
Basically, this is the beginnings of my program, although I have done a lot more; this seems to be where the trouble is coming from...