From 338e927cf8c8e16bae42c044de18f0633c76c842 Mon Sep 17 00:00:00 2001 From: llz-long <1784386738@qq.com> Date: Thu, 17 Apr 2025 17:34:18 +0800 Subject: [PATCH 1/4] up stsck --- .gitignore | 2 ++ linked_list_stack.c | 8 ++++++++ linked_list_stack.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 18c2e0e..129650a 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,5 @@ Module.symvers Mkfile.old dkms.conf /.vs/Project2 +*.tlog +*.tlog diff --git a/linked_list_stack.c b/linked_list_stack.c index 283a999..02c5470 100644 --- a/linked_list_stack.c +++ b/linked_list_stack.c @@ -41,4 +41,12 @@ int pop_stack_linked(stack_linked* s) free(tmp); tmp = NULL; return flog; +} +void print_linked(stack_linked* s) { + stack_node* L = s->top; + while (L != NULL) { + printf("%d", L->value); + L = L->next; + } + printf("\n"); } \ No newline at end of file diff --git a/linked_list_stack.h b/linked_list_stack.h index 46f4765..b3dd37b 100644 --- a/linked_list_stack.h +++ b/linked_list_stack.h @@ -23,6 +23,8 @@ void push_stack_linked(stack_linked* s, elem_type value); // ³öÕ» int pop_stack_linked(stack_linked* s); +//Êä³ö +void print_linked(stack_linked* s); From 65499ba86e700523fff416196883810fe5ae88eb Mon Sep 17 00:00:00 2001 From: llz-long <1784386738@qq.com> Date: Thu, 17 Apr 2025 17:46:05 +0800 Subject: [PATCH 2/4] up --- .gitignore | 2 ++ main.c | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 129650a..f7c70a6 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,5 @@ dkms.conf /.vs/Project2 *.tlog *.tlog +*.recipe +*.tlog diff --git a/main.c b/main.c index 32def12..c3fc1a8 100644 --- a/main.c +++ b/main.c @@ -1,8 +1,7 @@ #include #include #include -#include "array_stack.h" -#include "sq_list.h" +#include "linked_list_stack.h" int main(void) { @@ -26,14 +25,13 @@ int main(void) //mer_ge_sq_list(L,N); //print_sq_list(L); //printf("L->length:[%d]\n", L->length); - - - // Õ»²âÊÔ - array_stack* stack = init_array_stack(); - push_array_stack(stack, 1); - push_array_stack(stack, 2); - push_array_stack(stack, 3); - print_array_stack(stack); + stack_linked* head = init_stack_linked(); + push_stack_linked(head, 1); + push_stack_linked(head, 2); + push_stack_linked(head, 3); + print_linked(head); + pop_stack_linked(head); + print_linked(head); printf("Hello World!\n"); system("pause"); return 0; From c7c852261fbf0089eac335559ced64574db06420 Mon Sep 17 00:00:00 2001 From: llz-long <1784386738@qq.com> Date: Thu, 17 Apr 2025 17:46:34 +0800 Subject: [PATCH 3/4] up --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f7c70a6..879bc9e 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ dkms.conf *.tlog *.recipe *.tlog +/Project2 From fe42d04d8f47e2301ddf28baf10ba3c108aee201 Mon Sep 17 00:00:00 2001 From: llz-long <1784386738@qq.com> Date: Thu, 17 Apr 2025 17:46:54 +0800 Subject: [PATCH 4/4] Update .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 879bc9e..a89a933 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,7 @@ dkms.conf *.recipe *.tlog /Project2 +*.tlog +*.tlog +Project2/Debug/Project2.tlog/link.read.1.tlog +Project2/Debug/Project2.tlog/link.secondary.1.tlog