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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
algorithmique
lib_2021_malaspinas
stack
Merge requests
!18
Resolve "Add destroy function"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Resolve "Add destroy function"
9-add-destroy-function
into
main
Overview
0
Commits
4
Pipelines
0
Changes
2
Merged
joey.martig
requested to merge
9-add-destroy-function
into
main
3 years ago
Overview
0
Commits
4
Pipelines
0
Changes
2
Closes
#9 (closed)
0
0
Merge request reports
Compare
main
version 1
7207a59a
3 years ago
main (base)
and
latest version
latest version
00ae398c
4 commits,
3 years ago
version 1
7207a59a
3 commits,
3 years ago
2 files
+
9
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
stack.c
+
7
−
0
View file @ 00ae398c
Edit in single-file editor
Open in Web IDE
Show full file
@@ -11,6 +11,13 @@ void stack_init(stack *s)
@@ -11,6 +11,13 @@ void stack_init(stack *s)
s
->
data
=
malloc
(
sizeof
(
int
)
*
DEFAULT_CAPACITY
);
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
){
void
stack_peek
(
stack
s
,
int
*
value
){
if
(
!
stack_is_empty
(
s
))
{
if
(
!
stack_is_empty
(
s
))
{
*
value
=
s
.
data
[
s
.
top
];
*
value
=
s
.
data
[
s
.
top
];
Loading