function problem

void postfix(char *infix,char *postr)
{
int position,und;
int outpos=0;
char topsymb='+';
char symb;
struct stack opstk;
opstk.top=-1;
for(position=0; (symb=infix[position])!='\0'; position++)
if(isoperand(symb))
postr[outpos++]=symb;
else
{
popandtest(&opstk,&topsymb,&und);
while(!und &&prcd(topsymb,symb))
{
postr[outpos++]=topsymb;
popandtest(&opstk,&topsymb,&und);
}
if(!und)
push(&opstk,topsymb);
if(und||(symb!=')'))
push(&opstk,symb);
else
topsymb=pop(&opstk);
}
while(!empty(&opstk))
postr[outpos++]=pop(&opstk);
postr[outpos]='\0';
return;
}

can yu explain me what this popandtest() function is doing and what is the use of und .
getting problem because of these in the code.
please help

can yu explain me what this popandtest() function is doing and what is the use of und

Without seeing the code of popandtest it is impossible to know. und appears to be set by popandtest to some value, i.e. it is an output/return value of the function. Possibly boolean content, although type is int.
topsymb=opstk.pop(und);
return topsymb

is the definition for popandtest()
Please help
just guessing: und might be the size of the stack after an element has been popped

Then the name 'popandtest' would mean 'pop element and test size'
Last edited on
Topic archived. No new replies allowed.