-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add postfix evaluation algorithm #890
Conversation
Your arrays seem small to me (stack size of 10, input size of 25). Also consider using dynamic arrays. I find it quite odd that numbers can only be single characters - something like |
Hey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, this is looking awesome! 🚀 Thank you for your contribution! 😄👍
@appgurueu, feel free to review this PR and adjust as needed. Thanks. 🙂
Yes. I'd recommend a simple space as delimiter. You can do the following (in the loop) then: // Ignore delimiter
if (post[i] == ' ') continue;
if (isdigit(post[i])) {
int number = 0;
do {
number = number * 10 + (post[i]-'0');
i++;
} while (i < strlen(post) && isdigit(post[i]));
push(number);
continue;
} |
Hey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, looks like your tests aren't made properly 👀 it also doesn't run when I try to run it.
Could you please fix those problems? Let us know if you need any help here or in our Discord server. 😃
Looks like this is a c++ compiler 👀 . In a C compiler it is working just fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Work @kumaryash18
Description of Change
added postfix expression evaluation algorithm in misc
References
Checklist
Notes:
A program in C to evaluate postfix expression