C Fundamentals
Algorithms · data structures · cryptography · systems — pure C11, zero deps
Loading...
Searching...
No Matches
stack.c File Reference
#include "stack.h"
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  cf_stack
 

Macros

#define CF_STACK_INITIAL_CAP   16
 

Functions

cf_stack_tcf_stack_create (void)
 
void cf_stack_destroy (cf_stack_t *s)
 
bool cf_stack_is_empty (const cf_stack_t *s)
 
bool cf_stack_peek (const cf_stack_t *s, int *out_value)
 
bool cf_stack_pop (cf_stack_t *s, int *out_value)
 
bool cf_stack_push (cf_stack_t *s, int value)
 
size_t cf_stack_size (const cf_stack_t *s)
 

Macro Definition Documentation

◆ CF_STACK_INITIAL_CAP

#define CF_STACK_INITIAL_CAP   16

Definition at line 8 of file stack.c.

Function Documentation

◆ cf_stack_create()

cf_stack_t * cf_stack_create ( void  )

Definition at line 16 of file stack.c.

References cf_stack::capacity, CF_STACK_INITIAL_CAP, cf_stack::data, and cf_stack::size.

◆ cf_stack_destroy()

void cf_stack_destroy ( cf_stack_t s)

Definition at line 26 of file stack.c.

References cf_stack::data.

◆ cf_stack_is_empty()

bool cf_stack_is_empty ( const cf_stack_t s)

Definition at line 59 of file stack.c.

References cf_stack::size.

◆ cf_stack_peek()

bool cf_stack_peek ( const cf_stack_t s,
int *  out_value 
)

Definition at line 52 of file stack.c.

References cf_stack::data, and cf_stack::size.

◆ cf_stack_pop()

bool cf_stack_pop ( cf_stack_t s,
int *  out_value 
)

Definition at line 45 of file stack.c.

References cf_stack::data, and cf_stack::size.

◆ cf_stack_push()

bool cf_stack_push ( cf_stack_t s,
int  value 
)

Definition at line 32 of file stack.c.

References cf_stack::capacity, cf_stack::data, and cf_stack::size.

◆ cf_stack_size()

size_t cf_stack_size ( const cf_stack_t s)

Definition at line 58 of file stack.c.

References cf_stack::size.