From 5db5e35a69dedb7fed2ee6e374e5ef0990cceb25 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Thu, 9 Oct 2025 14:35:04 +0300 Subject: [PATCH 01/18] add src --- src/hello.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/hello.c diff --git a/src/hello.c b/src/hello.c new file mode 100644 index 0000000..807d128 --- /dev/null +++ b/src/hello.c @@ -0,0 +1,8 @@ +#include +int main() +{ + printf("Hello, world!\n"); + + + return 0; +} From d0c62119c36fa971a3fdecb930d2ef6926b959ae Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Thu, 16 Oct 2025 19:33:06 +0300 Subject: [PATCH 02/18] add stack --- src/hello.c | 8 -------- src/instruction.txt | 9 +++++++++ src/stack.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ src/stack.h | 15 +++++++++++++++ 4 files changed, 71 insertions(+), 8 deletions(-) delete mode 100644 src/hello.c create mode 100644 src/instruction.txt create mode 100644 src/stack.c create mode 100644 src/stack.h diff --git a/src/hello.c b/src/hello.c deleted file mode 100644 index 807d128..0000000 --- a/src/hello.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -int main() -{ - printf("Hello, world!\n"); - - - return 0; -} diff --git a/src/instruction.txt b/src/instruction.txt new file mode 100644 index 0000000..bb218c5 --- /dev/null +++ b/src/instruction.txt @@ -0,0 +1,9 @@ +Task1: +gcc -Wall -Wextra -pedantic -c stack.c +gcc -Wall -Wextra -pedantic -c task1.c +gcc -Wall -Wextra -pedantic stack.o task1.o -o steakTask1 + +Task2: +gcc -Wall -Wextra -pedantic -c stack.c +gcc -Wall -Wextra -pedantic -c task2.c +gcc -Wall -Wextra -pedantic stack.o task2.o -o steakTask2 \ No newline at end of file diff --git a/src/stack.c b/src/stack.c new file mode 100644 index 0000000..585139c --- /dev/null +++ b/src/stack.c @@ -0,0 +1,47 @@ +#include +#include + +struct StackNode { + int value; + struct StackNode* next; +}; + +struct Stack { + struct StackNode* head; +}; + +struct Stack new(void) +{ + struct Stack stack = { + .head = NULL + }; + return stack; +} + +void push(struct Stack* stack, int value) +{ + struct StackNode* node = (struct StackNode*)malloc(sizeof(struct StackNode)); + + node->value = value; + node->next = stack->head; + stack->head = node; +} + +int pop(struct Stack* stack) +{ + if (stack->head == NULL) { + return 0; + } + struct StackNode* oldNode = stack->head; + int res = oldNode->value; + stack->head = oldNode->next; + + free(oldNode); + + return res; +} + +int isEmpty(struct Stack* stack) +{ + return stack->head == NULL; +} diff --git a/src/stack.h b/src/stack.h new file mode 100644 index 0000000..e012d21 --- /dev/null +++ b/src/stack.h @@ -0,0 +1,15 @@ +#pragma once + +struct StackNode { + int value; + struct StackNode* next; +}; + +struct Stack { + struct StackNode* head; +}; + +struct Stack new(void); +void push(struct Stack* stack, int value); +int pop(struct Stack* stack); +int isEmpty(struct Stack* stack); From 268813de7575cd88b21c31b2db2aa3a7aadf4c9b Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Thu, 30 Oct 2025 00:45:57 +0300 Subject: [PATCH 03/18] add dir stack/ --- src/{ => stack}/stack.c | 0 src/{ => stack}/stack.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/{ => stack}/stack.c (100%) rename src/{ => stack}/stack.h (100%) diff --git a/src/stack.c b/src/stack/stack.c similarity index 100% rename from src/stack.c rename to src/stack/stack.c diff --git a/src/stack.h b/src/stack/stack.h similarity index 100% rename from src/stack.h rename to src/stack/stack.h From 63f39a65ad1f86502fefac04af4f457ed90666fe Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Thu, 16 Oct 2025 19:39:40 +0300 Subject: [PATCH 04/18] add task1.c --- src/task1.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/task1.c diff --git a/src/task1.c b/src/task1.c new file mode 100644 index 0000000..297a802 --- /dev/null +++ b/src/task1.c @@ -0,0 +1,40 @@ +#include "stack.h" +#include + +int isBalanced(char* s) +{ + struct Stack st = new(); + + for (int i = 0; s[i] != '\0'; ++i) { + char c = s[i]; + if (c == '(' || c == '[' || c == '{') { + push(&st, c); + } else if (c == ')' || c == ']' || c == '}') { + if (isEmpty(&st)) { + return 0; + } + char t = pop(&st); + if ((c == ')' && t != '(') || (c == ']' && t != '[') || (c == '}' && t != '{')) { + return 0; + } + } + } + + int res = isEmpty(&st); + return res; +} + +int main(void) +{ + char str[100]; + + printf("строка: "); + scanf("%s", str); + + if (isBalanced(str)) + printf("верно\n"); + else + printf("неверно\n"); + + return 0; +} \ No newline at end of file From ba11e7df15e1040f33bfedbd45c195ebb614cfa0 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Thu, 30 Oct 2025 01:30:42 +0300 Subject: [PATCH 05/18] move files to stack/ --- src/{ => stack}/instruction.txt | 0 src/{ => stack}/task1.c | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/{ => stack}/instruction.txt (100%) rename src/{ => stack}/task1.c (100%) diff --git a/src/instruction.txt b/src/stack/instruction.txt similarity index 100% rename from src/instruction.txt rename to src/stack/instruction.txt diff --git a/src/task1.c b/src/stack/task1.c similarity index 100% rename from src/task1.c rename to src/stack/task1.c From 14cfea6e54b3eaf22fef716b487d1dd159ee6009 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Fri, 31 Oct 2025 00:09:42 +0300 Subject: [PATCH 06/18] add CMake for stack --- src/stack/CmakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/stack/CmakeLists.txt diff --git a/src/stack/CmakeLists.txt b/src/stack/CmakeLists.txt new file mode 100644 index 0000000..e953bef --- /dev/null +++ b/src/stack/CmakeLists.txt @@ -0,0 +1,9 @@ +add_library(stack stack.c) + +add_executable(task1 task1.c) + +target_link_libraries(task1 PRIVATE stack) + +add_executable(task2 task2.c) + +target_link_libraries(task2 PRIVATE stack) From 3669845906e4e7684827d7b4e3a664af15586ea7 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Fri, 31 Oct 2025 00:59:52 +0300 Subject: [PATCH 07/18] correction cmake --- CMakeLists.txt | 6 ++++++ src/stack/{CmakeLists.txt => CMakeLists.txt} | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 CMakeLists.txt rename src/stack/{CmakeLists.txt => CMakeLists.txt} (58%) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8616e4f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.25) +project(homeworks C) + +add_compile_options(-Wall -Wextra -pedantic) + +add_subdirectory(src/stack) \ No newline at end of file diff --git a/src/stack/CmakeLists.txt b/src/stack/CMakeLists.txt similarity index 58% rename from src/stack/CmakeLists.txt rename to src/stack/CMakeLists.txt index e953bef..47875ea 100644 --- a/src/stack/CmakeLists.txt +++ b/src/stack/CMakeLists.txt @@ -4,6 +4,6 @@ add_executable(task1 task1.c) target_link_libraries(task1 PRIVATE stack) -add_executable(task2 task2.c) -target_link_libraries(task2 PRIVATE stack) + + From 5da790ee09dcace5f74ea4a010b3c5f44d7f6df3 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 14 Dec 2025 22:20:18 +0300 Subject: [PATCH 08/18] fixed files --- src/stack/stack.c | 26 ++++++++++++++++---------- src/stack/stack.h | 18 ++++++------------ src/stack/task1.c | 16 ++++++++++------ 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/stack/stack.c b/src/stack/stack.c index 585139c..40ee872 100644 --- a/src/stack/stack.c +++ b/src/stack/stack.c @@ -1,5 +1,6 @@ #include #include +#include "stack.h" struct StackNode { int value; @@ -10,11 +11,11 @@ struct Stack { struct StackNode* head; }; -struct Stack new(void) +Stack* new() { - struct Stack stack = { - .head = NULL - }; + Stack* stack = (Stack*)malloc(sizeof(Stack)); + if (!stack) return NULL; + stack->head = NULL; return stack; } @@ -27,21 +28,26 @@ void push(struct Stack* stack, int value) stack->head = node; } -int pop(struct Stack* stack) + +int pop(Stack* stack) { - if (stack->head == NULL) { - return 0; - } struct StackNode* oldNode = stack->head; int res = oldNode->value; - stack->head = oldNode->next; + stack->head = oldNode->next; free(oldNode); return res; } -int isEmpty(struct Stack* stack) +int isEmpty(Stack* stack) { return stack->head == NULL; } + +void delete(Stack* stack){ + while (!isEmpty(stack)) { + pop(stack); + } + free(stack); +} \ No newline at end of file diff --git a/src/stack/stack.h b/src/stack/stack.h index e012d21..b013a3f 100644 --- a/src/stack/stack.h +++ b/src/stack/stack.h @@ -1,15 +1,9 @@ #pragma once -struct StackNode { - int value; - struct StackNode* next; -}; +typedef struct Stack Stack; -struct Stack { - struct StackNode* head; -}; - -struct Stack new(void); -void push(struct Stack* stack, int value); -int pop(struct Stack* stack); -int isEmpty(struct Stack* stack); +Stack* new(); // создание стека +void push(Stack* stack, int value); // добавляеи элемент на вершину стека +int pop(Stack* stack); // убирает из стека элемент и возвращает его +int isEmpty(Stack* stack); +void delete(Stack* stack); // удаление стека \ No newline at end of file diff --git a/src/stack/task1.c b/src/stack/task1.c index 297a802..571286a 100644 --- a/src/stack/task1.c +++ b/src/stack/task1.c @@ -1,26 +1,30 @@ #include "stack.h" +#include #include -int isBalanced(char* s) +bool isBalanced(const char* s) { - struct Stack st = new(); + Stack* st = newStack(); for (int i = 0; s[i] != '\0'; ++i) { char c = s[i]; - if (c == '(' || c == '[' || c == '{') { + if ((c == '(' || c == '[' || c == '{')) { push(&st, c); } else if (c == ')' || c == ']' || c == '}') { if (isEmpty(&st)) { - return 0; + delete(&st); + return false; } char t = pop(&st); if ((c == ')' && t != '(') || (c == ']' && t != '[') || (c == '}' && t != '{')) { - return 0; + delete(&st); + return false; } } } - int res = isEmpty(&st); + bool res = isEmpty(&st); + delete(&st); return res; } From 16e57d9863b0cbfbea1660c0b1645fe40d988253 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 14 Dec 2025 22:25:37 +0300 Subject: [PATCH 09/18] fixed stack.c --- src/stack/stack.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/stack/stack.c b/src/stack/stack.c index 585139c..017ad76 100644 --- a/src/stack/stack.c +++ b/src/stack/stack.c @@ -1,5 +1,6 @@ #include #include +#include "stack.h" struct StackNode { int value; @@ -10,11 +11,11 @@ struct Stack { struct StackNode* head; }; -struct Stack new(void) +Stack* new() { - struct Stack stack = { - .head = NULL - }; + Stack* stack = (Stack*)malloc(sizeof(Stack)); + if (!stack) return NULL; + stack->head = NULL; return stack; } @@ -27,21 +28,26 @@ void push(struct Stack* stack, int value) stack->head = node; } -int pop(struct Stack* stack) + +int pop(Stack* stack) { - if (stack->head == NULL) { - return 0; - } struct StackNode* oldNode = stack->head; int res = oldNode->value; - stack->head = oldNode->next; + stack->head = oldNode->next; free(oldNode); return res; } -int isEmpty(struct Stack* stack) +int isEmpty(Stack* stack) { return stack->head == NULL; } + +void delete(Stack* stack){ + while (!isEmpty(stack)) { + pop(stack); + } + free(stack); +} From 2049e5ee57457456c2b0c5187cab760ab88f2bae Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 14 Dec 2025 22:26:41 +0300 Subject: [PATCH 10/18] fixed stack.h --- src/stack/stack.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/stack/stack.h b/src/stack/stack.h index e012d21..b013a3f 100644 --- a/src/stack/stack.h +++ b/src/stack/stack.h @@ -1,15 +1,9 @@ #pragma once -struct StackNode { - int value; - struct StackNode* next; -}; +typedef struct Stack Stack; -struct Stack { - struct StackNode* head; -}; - -struct Stack new(void); -void push(struct Stack* stack, int value); -int pop(struct Stack* stack); -int isEmpty(struct Stack* stack); +Stack* new(); // создание стека +void push(Stack* stack, int value); // добавляеи элемент на вершину стека +int pop(Stack* stack); // убирает из стека элемент и возвращает его +int isEmpty(Stack* stack); +void delete(Stack* stack); // удаление стека \ No newline at end of file From a26f9bd790a0b99c3473add2e96a1d9aab37ecb3 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 14 Dec 2025 22:35:44 +0300 Subject: [PATCH 11/18] formatting changes --- src/stack/stack.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/stack/stack.c b/src/stack/stack.c index 017ad76..c1c1b66 100644 --- a/src/stack/stack.c +++ b/src/stack/stack.c @@ -1,6 +1,6 @@ +#include "stack.h" #include #include -#include "stack.h" struct StackNode { int value; @@ -14,7 +14,8 @@ struct Stack { Stack* new() { Stack* stack = (Stack*)malloc(sizeof(Stack)); - if (!stack) return NULL; + if (!stack) + return NULL; stack->head = NULL; return stack; } @@ -28,7 +29,6 @@ void push(struct Stack* stack, int value) stack->head = node; } - int pop(Stack* stack) { struct StackNode* oldNode = stack->head; @@ -45,7 +45,8 @@ int isEmpty(Stack* stack) return stack->head == NULL; } -void delete(Stack* stack){ +void delete(Stack* stack) +{ while (!isEmpty(stack)) { pop(stack); } From 84cc9329be706453d8e09296472dbfb74d9e5251 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 14 Dec 2025 22:39:20 +0300 Subject: [PATCH 12/18] formatting changes --- src/stack/stack.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/stack/stack.c b/src/stack/stack.c index 40ee872..0881476 100644 --- a/src/stack/stack.c +++ b/src/stack/stack.c @@ -1,6 +1,6 @@ +#include "stack.h" #include #include -#include "stack.h" struct StackNode { int value; @@ -14,7 +14,8 @@ struct Stack { Stack* new() { Stack* stack = (Stack*)malloc(sizeof(Stack)); - if (!stack) return NULL; + if (!stack) + return NULL; stack->head = NULL; return stack; } @@ -28,7 +29,6 @@ void push(struct Stack* stack, int value) stack->head = node; } - int pop(Stack* stack) { struct StackNode* oldNode = stack->head; @@ -45,7 +45,8 @@ int isEmpty(Stack* stack) return stack->head == NULL; } -void delete(Stack* stack){ +void delete(Stack* stack) +{ while (!isEmpty(stack)) { pop(stack); } From 0631b73198288fa3f98d9f1185b45a3784462565 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 14 Dec 2025 22:59:59 +0300 Subject: [PATCH 13/18] formatting changes --- src/stack/stack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stack/stack.h b/src/stack/stack.h index b013a3f..58cbc51 100644 --- a/src/stack/stack.h +++ b/src/stack/stack.h @@ -6,4 +6,4 @@ Stack* new(); // создание стека void push(Stack* stack, int value); // добавляеи элемент на вершину стека int pop(Stack* stack); // убирает из стека элемент и возвращает его int isEmpty(Stack* stack); -void delete(Stack* stack); // удаление стека \ No newline at end of file +void delete(Stack* stack); // удаление стека From 652c43cae14bc3a38e9454ed89f8094344d3a49b Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 21 Dec 2025 14:08:43 +0300 Subject: [PATCH 14/18] added comments for a function, changed the names of the deletion function --- src/stack/stack.c | 2 +- src/stack/stack.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stack/stack.c b/src/stack/stack.c index c1c1b66..a9b4145 100644 --- a/src/stack/stack.c +++ b/src/stack/stack.c @@ -45,7 +45,7 @@ int isEmpty(Stack* stack) return stack->head == NULL; } -void delete(Stack* stack) +void deleteStack(Stack* stack) { while (!isEmpty(stack)) { pop(stack); diff --git a/src/stack/stack.h b/src/stack/stack.h index b013a3f..fa3abdb 100644 --- a/src/stack/stack.h +++ b/src/stack/stack.h @@ -2,8 +2,8 @@ typedef struct Stack Stack; -Stack* new(); // создание стека -void push(Stack* stack, int value); // добавляеи элемент на вершину стека -int pop(Stack* stack); // убирает из стека элемент и возвращает его +Stack* new(); // Создание стека. +void push(Stack* stack, int value); // Добавляет элемент на вершину стека. +int pop(Stack* stack); // Убирает из стека элемент и возвращает его. Необходимо проверять isEmpty перед вызовом int isEmpty(Stack* stack); -void delete(Stack* stack); // удаление стека \ No newline at end of file +void deleteStack(Stack* stack); // Удаление стека. \ No newline at end of file From 11289a8d2f9588fc84bffc03e6e9e9f2a8951020 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 21 Dec 2025 14:25:49 +0300 Subject: [PATCH 15/18] fixed the file --- src/stack/CMakeLists.txt | 4 ---- src/stack/task1.c | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/stack/CMakeLists.txt b/src/stack/CMakeLists.txt index 47875ea..ae34397 100644 --- a/src/stack/CMakeLists.txt +++ b/src/stack/CMakeLists.txt @@ -3,7 +3,3 @@ add_library(stack stack.c) add_executable(task1 task1.c) target_link_libraries(task1 PRIVATE stack) - - - - diff --git a/src/stack/task1.c b/src/stack/task1.c index 571286a..c3bfc53 100644 --- a/src/stack/task1.c +++ b/src/stack/task1.c @@ -4,7 +4,7 @@ bool isBalanced(const char* s) { - Stack* st = newStack(); + Stack* st = new(); for (int i = 0; s[i] != '\0'; ++i) { char c = s[i]; @@ -12,19 +12,19 @@ bool isBalanced(const char* s) push(&st, c); } else if (c == ')' || c == ']' || c == '}') { if (isEmpty(&st)) { - delete(&st); + deleteStack(&st); return false; } char t = pop(&st); if ((c == ')' && t != '(') || (c == ']' && t != '[') || (c == '}' && t != '{')) { - delete(&st); + deleteStack(&st); return false; } } } bool res = isEmpty(&st); - delete(&st); + deleteStack(&st); return res; } From 0b3fceaa34bbc08bb0ac7a0e22cc480efe19cfa2 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 21 Dec 2025 14:31:09 +0300 Subject: [PATCH 16/18] fixed again --- src/stack/stack.c | 3 +-- src/stack/stack.h | 2 +- src/stack/task1.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/stack/stack.c b/src/stack/stack.c index 11147f2..7f78ed2 100644 --- a/src/stack/stack.c +++ b/src/stack/stack.c @@ -11,7 +11,7 @@ struct Stack { struct StackNode* head; }; -Stack* new() +Stack* newStack() { Stack* stack = (Stack*)malloc(sizeof(Stack)); if (!stack) @@ -51,7 +51,6 @@ void deleteStack(Stack* stack) pop(stack); } free(stack); - } diff --git a/src/stack/stack.h b/src/stack/stack.h index 6249819..d26ffea 100644 --- a/src/stack/stack.h +++ b/src/stack/stack.h @@ -2,7 +2,7 @@ typedef struct Stack Stack; -Stack* new(); // Создание стека. +Stack* newStack(); // Создание стека. void push(Stack* stack, int value); // Добавляет элемент на вершину стека. int pop(Stack* stack); // Убирает из стека элемент и возвращает его. Необходимо проверять isEmpty перед вызовом int isEmpty(Stack* stack); diff --git a/src/stack/task1.c b/src/stack/task1.c index c3bfc53..f9e190c 100644 --- a/src/stack/task1.c +++ b/src/stack/task1.c @@ -4,7 +4,7 @@ bool isBalanced(const char* s) { - Stack* st = new(); + Stack* st = newStack(); for (int i = 0; s[i] != '\0'; ++i) { char c = s[i]; From 33a950e53f4731d01e69ed358f3a1bece09021b4 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Sun, 21 Dec 2025 14:33:57 +0300 Subject: [PATCH 17/18] fixed format --- src/stack/stack.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/stack/stack.c b/src/stack/stack.c index 7f78ed2..4674854 100644 --- a/src/stack/stack.c +++ b/src/stack/stack.c @@ -51,6 +51,4 @@ void deleteStack(Stack* stack) pop(stack); } free(stack); -} - - +} \ No newline at end of file From b0e727dbc53b56821aee6815e7f61026028efe80 Mon Sep 17 00:00:00 2001 From: anna shalahina Date: Mon, 22 Dec 2025 13:52:43 +0300 Subject: [PATCH 18/18] fixed task1 --- src/stack/task1.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/stack/task1.c b/src/stack/task1.c index f9e190c..1a24271 100644 --- a/src/stack/task1.c +++ b/src/stack/task1.c @@ -9,13 +9,13 @@ bool isBalanced(const char* s) for (int i = 0; s[i] != '\0'; ++i) { char c = s[i]; if ((c == '(' || c == '[' || c == '{')) { - push(&st, c); + push(st, c); } else if (c == ')' || c == ']' || c == '}') { - if (isEmpty(&st)) { - deleteStack(&st); + if (isEmpty(st)) { + deleteStack(st); return false; } - char t = pop(&st); + char t = pop(st); if ((c == ')' && t != '(') || (c == ']' && t != '[') || (c == '}' && t != '{')) { deleteStack(&st); return false; @@ -23,8 +23,8 @@ bool isBalanced(const char* s) } } - bool res = isEmpty(&st); - deleteStack(&st); + bool res = isEmpty(st); + deleteStack(st); return res; }