Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
algorithmique
lib_2021_malaspinas
stack
Commits
e4bcf652
Commit
e4bcf652
authored
3 years ago
by
orestis.malaspin
Browse files
Options
Downloads
Plain Diff
Merge branch '9-add-destroy-function' into 'main'
Resolve "Add destroy function" Closes
#9
See merge request
!18
parents
25c9c05a
bec8b7b6
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!18
Resolve "Add destroy function"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
stack.c
+7
-0
7 additions, 0 deletions
stack.c
stack.h
+2
-0
2 additions, 0 deletions
stack.h
with
9 additions
and
0 deletions
stack.c
+
7
−
0
View file @
e4bcf652
...
...
@@ -11,6 +11,13 @@ void stack_init(stack *s)
s
->
data
=
malloc
(
sizeof
(
int
)
*
DEFAULT_CAPACITY
);
}
void
stack_destroy
(
stack
*
s
){
free
(
s
->
data
);
s
->
data
=
NULL
;
s
->
capacity
=
-
1
;
s
->
top
=
-
1
;
}
void
stack_peek
(
stack
s
,
int
*
value
){
if
(
!
stack_is_empty
(
s
))
{
*
value
=
s
.
data
[
s
.
top
];
...
...
This diff is collapsed.
Click to expand it.
stack.h
+
2
−
0
View file @
e4bcf652
...
...
@@ -9,6 +9,8 @@ typedef struct _stack {
void
stack_init
(
stack
*
stack
);
void
stack_destroy
(
stack
*
s
);
void
stack_peek
(
stack
s
,
int
*
value
);
void
stack_clone
(
stack
s
,
stack
*
clone
);
int
get_length
(
stack
s
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment