Hey guys, i'm working on a program that gets a postfix expression and calculates it..
I have two functions:
- Converts infix to postfix
- Calculate the postfix
When I try small expressions, like 1+1 or (1+1)*1, it works fine but when i use all the operands I get something nasty,
Here is the example: 2*2/2+1-1 gets something like: 222/*11-+T_CHECKÖÐ7?█Ã
If you see, the expression is right until the 'T'
I believe it's some parameter mistake, so i'll put the header and return values here
1st)
char* convert(char *infix);
char *post = (char *)malloc(sizeof(char)*tamP);
return post;
2nd)
int evaluate(char *postfix)
while (*postfix != '\0')
return result;
Caller)
char* post = convert(infix);
result = evaluate(post);
Thanks