Question: I keep getting this error on my code. And I'm wondering what I did wrong. int actualConversion(Element element, PostfixOut postfixout, Stack stack){ ^ p1egh874.c:1:39: error:

I keep getting this error on my code. And I'm wondering what I did wrong.

int actualConversion(Element element, PostfixOut postfixout, Stack stack){

^

p1egh874.c:1:39: error: unknown type name PostfixOut

int actualConversion(Element element, PostfixOut postfixout, Stack stack){

^

p1egh874.c:1:62: error: unknown type name Stack

int actualConversion(Element element, PostfixOut postfixout, Stack stack){

^

p1egh874.c:39:20: error: unknown type name Stack

int remainingStack(Stack stack, PostfixOut postfixout)

^

p1egh874.c:39:33: error: unknown type name PostfixOut

int remainingStack(Stack stack, PostfixOut postfixout)

^

p1egh874.c:53:38: error: unknown type name PostfixOut

int convertToPostFix(char * pszInfix,PostfixOut postfixOut)

^

This is my code.

int actualConversion(Element element, PostfixOut postfixout, Stack stack){

switch(element.iCategory)

{

case CAT_OPERAND:

addOut(postfixout,element);

break;

case CAT_OPERATOR:

while (isEmpty(stack) == FALSE && element.iPrecedence < topElement(stack).iPrecedence) //Continuous loop until stack is empty

{

addOut(postfixout,pop(stack));

}

push(stack,element);

break;

case CAT_LPAREN:

push(stack,element);

break;

case CAT_RPAREN;

while(isEmpty(stack) == False && topElement(stack).iCategory != CAT_LPAREN)

{

addOut(postfixout,pop(stack));

}

if(isEmpty(stack) == TRUE) //For when we didn't fine a '('

{

freeStack(stack);

return WARN_MISSING_LPAREN;

}

pop(stack);

break;

}

return 0;

}

int remainingStack(Stack stack, PostfixOut postfixout)

{

while(isEmpty(stack) == FALSE)

{

if(topElement(stack).iCategory == CAT_LPAREN) //for when an unmaatched '(' is found

{

freeStack(stack);

return WARN_MISSING_RPAREN;

}

int addOut(postfixout,pop(stack));

}

return 0;

}

int convertToPostFix(char * pszInfix,PostfixOut postfixOut)

{

Stack stack = newStack();

Token szToken;

while((pszInfix = getToken(pszInfix, szToken, MAX_TOKEN + 1))! = 0)

{

Element element;

strcpy(element.szToken,szToken);

categorize(& element); //initialize the Elements variable values based on the token string entered

}

int i;

i = actualConversion(element, postfixout, stack);

if (i!=0) return i;

i = remainingStack(stack, postfixout);

if(i!=0) return i;

freeStack(stack);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!