Skip to content

Comments

Advanced bracket balance. Kalsina Yana.#7

Open
yaprogrammer18-yanchi wants to merge 23 commits intomainfrom
bracket_balance_task_branch
Open

Advanced bracket balance. Kalsina Yana.#7
yaprogrammer18-yanchi wants to merge 23 commits intomainfrom
bracket_balance_task_branch

Conversation

@yaprogrammer18-yanchi
Copy link
Owner

Добавила файл к домашней работе "Продвинутый баланс скобок". Здесь три файла:

  • файл с решением задачи
  • файл с реализацией стека
  • файл с объявлениями структур и функций стека
    последние два файла изначально были созданы на ветке стека.

Copy link
Collaborator

@WoWaster WoWaster left a comment

Choose a reason for hiding this comment

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

Со стилем всё ещё беды :( При том если в стеке минимум косяков, то вот в балансе что-то как-то всё плохо.

Copy link
Collaborator

@WoWaster WoWaster left a comment

Choose a reason for hiding this comment

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

Совсем косметика и будет хорошо.

.gitignore Outdated
*.pdb

# Kernel Module Compile Results
# Kernel Module Comspile Results
Copy link
Collaborator

Choose a reason for hiding this comment

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

????

char tmp = ' ';
int length = strlen(stringWithBrackets);
for (int i = 0; i < length; i++) {
tmp = stringWithBrackets[i];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Безопаснее делать так:

Suggested change
tmp = stringWithBrackets[i];
char ch = stringWithBrackets[i];

Чтобы переменная не была общей между итерациями цикла.
Ну и название tmp прям совсем не информативно. ch не сказать, что шибко лучше, но хотя бы понятно, что это некий символ

Comment on lines 29 to 31
else if ((tmp == ')' || tmp == '}' || tmp == ']') && (isEmpty(stack))) {
isBalanced = false;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
else if ((tmp == ')' || tmp == '}' || tmp == ']') && (isEmpty(stack))) {
isBalanced = false;
}
else if ((tmp == ')' || tmp == '}' || tmp == ']') && (isEmpty(stack))) {
isBalanced = false;
break;
}

?

Copy link
Collaborator

@WoWaster WoWaster left a comment

Choose a reason for hiding this comment

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

И здесь "Ура"!

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