Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stack.c "202112289 이재성" #404

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions stack.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <stdio.h>
#include <stdlib.h>
#includ
<stdlib.h>
#include "stack.h"
#include <string.h>

Stack * create_stack(int initial_size)
{
Stack * s = (Stack *)malloc(sizeof(Stack));
s->contents = (int *)malloc(initial_size*sizeof(Item));
s->top=0;
s->size=initial_size;
return s;
}
Expand All @@ -33,6 +33,7 @@ void push(Stack * stack, Item i)
reallocate(stack);
stack->contents[stack->top++] = i;
printf("--Pushded: %d\n", i);
printf("202112289 이재성\n"); // plus code
}

Item pop(Stack * stack)
Expand All @@ -41,8 +42,6 @@ Item pop(Stack * stack)
stack_underflow();
else {
printf("--Poped: %d\n", stack->contents[stack->top-1]);
return stack->contents[--stack->top];
}
return '\0'; /* prevents compiler warning due to stack_underflow() call */
}

Expand Down