Skip to content

Sort station - #8

Open
EStarikov wants to merge 2 commits into
mainfrom
sort_station
Open

Sort station#8
EStarikov wants to merge 2 commits into
mainfrom
sort_station

Conversation

@EStarikov

Copy link
Copy Markdown
Owner

No description provided.

@EStarikov
EStarikov requested a review from chernishev October 16, 2025 21:13
Comment thread src/stack/station.c
#include <string.h>
#include "stack.h"

int definition(char a) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

При чём тут definition? Это priority, или как-нибудь так.

Comment thread src/stack/station.c
}
return 0;
}
int main() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше выделить алгоритм в отдельную функцию

Comment thread src/stack/station.c
int index = 0;
for (int i = 0; s[i] != '\0'; ++i) {
int t = definition(s[i]);
if (t == 0) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если Вы хотите кодировать категорию символа числом (что, в целом, довольно хорошее решение), то используйте символьные константы:

#define RPAREN -2
#define LPAREN -1
#define OTHER 0
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants