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
Compare revisions
e2b5ab74415e23bdd585b78b85d81f39bab323e5 to 1dec4649bca3ff316c517467e7471fd4e881bc1e
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
algorithmique/lib_2021_malaspinas/stack
Select target project
No results found
1dec4649bca3ff316c517467e7471fd4e881bc1e
Select Git revision
Branches
3-add-makefile-with-structure
4-add-create-init-function
5-add-push-function-2
9-add-destroy-function-2
9-add-destroy-function-3
9-add-destroy-function-4
main
Tags
v0.1
8 results
Swap
Target
algorithmique/lib_2021_malaspinas/stack
Select target project
algorithmique/lib_2021_malaspinas/stack
1 result
e2b5ab74415e23bdd585b78b85d81f39bab323e5
Select Git revision
Branches
3-add-makefile-with-structure
4-add-create-init-function
5-add-push-function-2
9-add-destroy-function-2
9-add-destroy-function-3
9-add-destroy-function-4
main
Tags
v0.1
8 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
* Add stack_print(stack) function (when is_empty is available change implementation slightly)
· 5a8d23e3
boris.stefanov
authored
3 years ago
and
orestis.malaspin
committed
3 years ago
5a8d23e3
Merge branch '12-add-print-function' into 'main'
· 1dec4649
orestis.malaspin
authored
3 years ago
Add stack_print(stack) function See merge request
!12
1dec4649
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
stack.c
+16
-1
16 additions, 1 deletion
stack.c
stack.h
+2
-0
2 additions, 0 deletions
stack.h
with
18 additions
and
1 deletion
stack.c
View file @
1dec4649
...
...
@@ -17,6 +17,20 @@ void stack_peek(stack s, int *value){
}
}
void
stack_print
(
const
stack
s
)
{
//TODO: replace if statement with following as soon as relevant function is implemented
//if (!stack_is_empty()) {
if
(
s
.
top
>=
0
)
{
printf
(
" TOP
\n
--------------------
\n
"
);
for
(
int
*
spot
=
s
.
data
+
s
.
top
;
spot
>=
s
.
data
;
--
spot
)
{
printf
(
"%8d | %12d
\n
"
,
spot
-
s
.
data
,
*
spot
);
}
printf
(
"--------------------
\n
BOTTOM
\n
"
);
}
else
{
printf
(
"STACK EMPTY
\n
"
);
}
}
void
stack_clone
(
stack
s
,
stack
*
clone
)
{
clone
->
top
=
s
.
top
;
clone
->
capacity
=
s
.
capacity
;
...
...
@@ -24,4 +38,5 @@ void stack_clone(stack s, stack *clone) {
for
(
int
i
=
0
;
i
<=
s
.
top
&&
i
<
s
.
capacity
;
i
++
)
{
clone
->
data
[
i
]
=
s
.
data
[
i
];
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
stack.h
View file @
1dec4649
...
...
@@ -12,4 +12,6 @@ void stack_init(stack *stack);
void
stack_peek
(
stack
s
,
int
*
value
);
void
stack_clone
(
stack
s
,
stack
*
clone
);
void
stack_print
(
const
stack
s
);
#endif
This diff is collapsed.
Click to expand it.