Data Structures Lerax  v3.0-101-gb1f7
Opinionated Data Structures & Algorithms
Loading...
Searching...
No Matches
stack.h File Reference

Go to the source code of this file.

Macros

#define STACK_STATIC_MAX   10

Typedefs

typedef struct stack Stack
 A stack data structure.

Functions

Stackstack_create (void)
 Creates an empty stack.
int stack_empty (Stack *s)
 Checks if a stack is empty.
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.
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.
void stack_free (Stack *s)
 Frees the memory allocated for a stack.
int stack_top (Stack *s)
 Returns the element at the top of a stack without removing it.
int stack_odds (Stack *s)
 Counts the number of odd elements in a stack.

Macro Definition Documentation

◆ STACK_STATIC_MAX

#define STACK_STATIC_MAX   10

    Copyright 2017-2025 Manoel Vilela

    Author: Manoel Vilela
   Contact: manoel_vilela@engineer.com

Organization: UFC


Typedef Documentation

◆ Stack

typedef struct stack Stack

A stack data structure.