Skip to content

Comments

QueueWithStack(third test)#40

Open
Andrw-404 wants to merge 1 commit intomainfrom
thirdTest(secondTask)
Open

QueueWithStack(third test)#40
Andrw-404 wants to merge 1 commit intomainfrom
thirdTest(secondTask)

Conversation

@Andrw-404
Copy link
Owner

No description provided.


void deleteQueue(Queue* queue) {
while (!isEmpty(queue->firstStack) && !isEmpty(queue->secondStack)) {
}

Choose a reason for hiding this comment

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

:(

void deleteQueue(Queue* queue) {
while (!isEmpty(queue->firstStack) && !isEmpty(queue->secondStack)) {
}
}

Choose a reason for hiding this comment

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

И саму queue надо ещё удалить


int dequeue(Queue* queue);

Queue* createQueue(); No newline at end of file

Choose a reason for hiding this comment

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

deleteQueue тоже надо было вынести в заголовочный файл, и нужны комментарии

#include "stack.h"

typedef struct StackElement {
int value;

Choose a reason for hiding this comment

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

Тут внезапно табуляция вместо пробелов для отступа

void push(Stack* stack, int value) {
StackElement* element = malloc(sizeof(StackElement));
if (element == NULL) {
return;

Choose a reason for hiding this comment

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

Хорошо, что тут есть хоть какой-то контроль ошибок, но плохо, что вызывающий никак не может узнать, удался push или нет.


int pop(Stack* stack) {
if (stack->head == NULL) {
return 1;

Choose a reason for hiding this comment

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

Тут тоже, 1 может быть вполне корректным значением


Stack* createStack();

//function adds an item to the stack

Choose a reason for hiding this comment

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

Suggested change
//function adds an item to the stack
// function adds an item to the stack

<ItemGroup>
<ClInclude Include="queue.h" />
<ClInclude Include="stack.h" />
<ClInclude Include="testStack.h" />

Choose a reason for hiding this comment

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

testStack.h есть, а самих тестов нет

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