Data Structures Lerax  v3.0-104-ge031
Opinionated Data Structures & Algorithms
Loading...
Searching...
No Matches
stack.h
Go to the documentation of this file.
1
12
13#ifndef STACK_H
14#define STACK_H
15
16#define STACK_STATIC_MAX 10
17
21typedef struct stack Stack;
22
30
39
47void stack_push(Stack* s, int data);
48
57
65
74
82
83// additional functions
84
93
102
103#endif
int stack_odds(Stack *s)
Counts the number of odd elements in a stack.
void stack_push(Stack *s, int data)
Pushes an element onto the top of a stack.
int stack_pop(Stack *s)
Pops an element from the top of a stack.
int stack_top(Stack *s)
Returns the element at the top of a stack without removing it.
void stack_print(Stack *s)
Prints the elements of a stack to the console.
void stack_println(Stack *s)
Prints the elements of a stack to the console, followed by a newline character.
int stack_empty(Stack *s)
Checks if a stack is empty.
Stack * stack_create(void)
Creates an empty stack.
void stack_free(Stack *s)
Frees the memory allocated for a stack.
struct stack Stack
A stack data structure.
Definition stack.h:21