Skip to content

Comments

Продвинутый баланс скобок#5

Open
Andrew-Kochanov wants to merge 16 commits intomainfrom
hw5.balance.stap
Open

Продвинутый баланс скобок#5
Andrew-Kochanov wants to merge 16 commits intomainfrom
hw5.balance.stap

Conversation

@Andrew-Kochanov
Copy link
Owner

No description provided.

#include <stdlib.h>
#include <string.h>

void balance(char* str, int lenght)

Choose a reason for hiding this comment

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

Nit: lenght -> length

@@ -0,0 +1,366 @@
# This is the CMakeCache file.
# For build in directory: /home/andrew/src2/build
# It was generated by CMake: /usr/bin/cmake

Choose a reason for hiding this comment

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

Вот тут где-то имеется в виду, что этому файлу не место в репозитории.

@@ -0,0 +1,84 @@
set(CMAKE_C_COMPILER "/usr/bin/cc")

Choose a reason for hiding this comment

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

Ну и в целом всей build директории не место.

stack.c Outdated
struct StackNode* next;
};

// делаем ссулку на голову

Choose a reason for hiding this comment

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

Nit: ссылку :D

stack.c Outdated
#include "stack.h"
#include <stdio.h>
#include <stdlib.h>
// #include<stdbool.h>

Choose a reason for hiding this comment

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

Nit: в комментариях не должно быть "старого" кода. Для этого есть git.

stack.c Outdated
struct StackNode* head;
};

// создаем пустую тсруктуру с пустой ссылкой на нулевую голову

Choose a reason for hiding this comment

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

Nit: структуру

stack.c Outdated
Comment on lines 64 to 68
char peek(struct Stack* stack)
{
char result = stack->head->value;
return result;
}

Choose a reason for hiding this comment

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

Немного неожиданно, что peek() и pop() ведут себя по-разному. В смысле, первый в случае пустого стека вызовет неопределенное поведение, второй -- вернет \0

stack.c Outdated

void deleteStack(struct Stack* stack)
{
while (!isEmpty(stack)) {

Choose a reason for hiding this comment

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

Minor: хорошо перед этим проверить if (stack == NULL) return. Так можно не бояться того, что "почистим" неинициализированный стек. Иногда может быть удобно.

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