libdatatypes 0.3.2
Abstract datatypes for C.
Loading...
Searching...
No Matches
stack.c File Reference

Generic stack. More...

#include <stdlib.h>
#include <assert.h>
#include "stack.h"

Go to the source code of this file.

Functions

bool stack_pop (Stack *stack, void **data)
 
bool stack_head (const Stack *stack, void **data)
 

Detailed Description

Generic stack.

Author
Sebastian Fedrau sebas.nosp@m.tian.nosp@m..fedr.nosp@m.au@g.nosp@m.mail..nosp@m.com

Definition in file stack.c.

Function Documentation

◆ stack_head()

bool stack_head ( const Stack stack,
void **  data 
)
Parameters
stacka Stack
datalocation to store data
Returns
true if stack is not empty

Gets first element from stack without removing it.

Definition at line 55 of file stack.c.

◆ stack_pop()

bool stack_pop ( Stack stack,
void **  data 
)
Parameters
stacka Stack
datalocation to store data
Returns
true if stack is not empty

Pops the first element from the stack.

Definition at line 28 of file stack.c.