Merge pull request #4 from jdhnsu/lxy

Lxy
This commit is contained in:
蒋东桓 2025-04-17 18:02:04 +08:00 committed by GitHub
commit 4d35f7367f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 45 additions and 7 deletions

11
.gitignore vendored
View File

@ -51,6 +51,13 @@ Module.symvers
Mkfile.old Mkfile.old
dkms.conf dkms.conf
/.vs/Project2 /.vs/Project2
/.vs .vscode/
.vscode/settings.json *.tlog
*.tlog
*.recipe *.recipe
*.tlog
/Project2
*.tlog
*.tlog
Project2/Debug/Project2.tlog/link.read.1.tlog
Project2/Debug/Project2.tlog/link.secondary.1.tlog

View File

@ -41,4 +41,12 @@ int pop_stack_linked(stack_linked* s)
free(tmp); free(tmp);
tmp = NULL; tmp = NULL;
return flog; 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");
} }

View File

@ -23,6 +23,8 @@ void push_stack_linked(stack_linked* s, elem_type value);
// 出栈 // 出栈
int pop_stack_linked(stack_linked* s); int pop_stack_linked(stack_linked* s);
//输出
void print_linked(stack_linked* s);

31
main.c
View File

@ -1,13 +1,27 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "array_queue.h"
int main(void) int main(void)
{ {
//sq_list* L = init_sq_list();
//sq_list* N = init_sq_list();
//for (int i = 1; i <= 3; i++)
//{
// N->data[i - 1] = i+10;
//}
//for (int i = 1; i <= 10; i++)
//{
// L->data[i - 1] = i;
//}
//N->length = 3;
//L->length = 10;
//print_sq_list(N);
//print_sq_list(L);
//mer_ge_sq_list(L,N);
//print_sq_list(L);
//printf("L->length:[%d]\n", L->length);
/*sq_list* L = init_sq_list(); /*sq_list* L = init_sq_list();
sq_list* N = init_sq_list(); sq_list* N = init_sq_list();
for (int i = 1; i <= 3; i++) for (int i = 1; i <= 3; i++)
@ -62,7 +76,15 @@ int main(void)
// delete_node(q2); // delete_node(q2);
// print_node_list(q1); // print_node_list(q1);
/*
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);
*/
// queue_test(); // queue_test();
array_queue *q = init_array_queue(); array_queue *q = init_array_queue();
@ -76,7 +98,6 @@ int main(void)
printf("----------\n"); printf("----------\n");
push_array_queue(q, 666); push_array_queue(q, 666);
print_array_queue(q); print_array_queue(q);
printf("Hello World!\n"); printf("Hello World!\n");
system("pause"); system("pause");
return 0; return 0;