Design Pattern Examples
Overview of object-oriented design patterns
stack.h
Go to the documentation of this file.
1
5
6
#pragma once
7
#ifndef __STACK_H__
8
#define __STACK_H__
9
10
#include <stdbool.h>
11
31
typedef
struct
StackEntry
32
{
33
struct
StackEntry
*
next
;
34
void
*
item
;
35
}
StackEntry
;
36
44
void
Stack_Push
(
StackEntry
** stack,
void
*
item
);
45
54
void
*
Stack_Pop
(
StackEntry
** stack);
55
64
bool
Stack_IsEmpty
(
StackEntry
** stack);
65
66
#endif
// __STACK_H__
67
Stack_IsEmpty
bool Stack_IsEmpty(StackEntry **stack)
Determines if the given stack is empty.
Definition:
stack.c:82
Stack_Push
void Stack_Push(StackEntry **stack, void *item)
Push the given entry onto the given stack.
Definition:
stack.c:40
Stack_Pop
void * Stack_Pop(StackEntry **stack)
Pop the last entry from the given stack, returning the item.
Definition:
stack.c:63
StackEntry
Represents an entry on a simple stack that wraps an "item" represented by an opaque pointer.
Definition:
stack.h:32
StackEntry::next
struct StackEntry * next
Points to the next older entry in the stack.
Definition:
stack.h:33
StackEntry::item
void * item
The item being held in this entry in the stack.
Definition:
stack.h:34
c
helpers
stack.h
Generated on Tue Aug 29 2023 19:47:44 for Design Pattern Examples by
1.9.6