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
Merge requests
!20
Resolve "Add clear function"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Add clear function"
13-add-clear-function
into
main
Overview
10
Commits
5
Pipelines
0
Changes
2
All threads resolved!
Show all comments
Merged
orestis.malaspin
requested to merge
13-add-clear-function
into
main
3 years ago
Overview
10
Commits
5
Pipelines
0
Changes
2
All threads resolved!
Show all comments
Expand
Closes
#13 (closed)
Edited
3 years ago
by
orestis.malaspin
0
0
Merge request reports
Compare
main
version 4
c0c5bb92
3 years ago
version 3
2e0992eb
3 years ago
version 2
9808d031
3 years ago
version 1
f10345b1
3 years ago
main (base)
and
latest version
latest version
1ffdb7e2
5 commits,
3 years ago
version 4
c0c5bb92
4 commits,
3 years ago
version 3
2e0992eb
3 commits,
3 years ago
version 2
9808d031
2 commits,
3 years ago
version 1
f10345b1
1 commit,
3 years ago
2 files
+
20
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
stack.c
+
15
−
5
Options
#include
<stdlib.h>
#include
<stdbool.h>
#include
<stdio.h>
#include
"stack.h"
#include
<stdio.h>
#include
<stdlib.h>
#define DEFAULT_CAPACITY 4
@@ -87,4 +84,17 @@ int get_length(stack s) {
bool
stack_is_empty
(
stack
s
)
{
return
s
.
top
==
-
1
;
}
/**
* @brief Reset the stack's top to -1
* New values will overwrite the old ones
*
* @param s
*/
void
stack_clear
(
stack
*
s
)
{
s
->
top
=
-
1
;
s
->
capacity
=
DEFAULT_CAPACITY
;
s
->
data
=
realloc
(
s
->
data
,
sizeof
(
int
)
*
s
->
capacity
);
}
\ No newline at end of file
Loading