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
31typedef struct StackEntry
32{
33 struct StackEntry* next;
34 void* item;
36
44void Stack_Push(StackEntry** stack, void* item);
45
54void* Stack_Pop(StackEntry** stack);
55
64bool Stack_IsEmpty(StackEntry** stack);
65
66#endif // __STACK_H__
67
bool Stack_IsEmpty(StackEntry **stack)
Determines if the given stack is empty.
Definition: stack.c:82
void Stack_Push(StackEntry **stack, void *item)
Push the given entry onto the given stack.
Definition: stack.c:40
void * Stack_Pop(StackEntry **stack)
Pop the last entry from the given stack, returning the item.
Definition: stack.c:63
Represents an entry on a simple stack that wraps an "item" represented by an opaque pointer.
Definition: stack.h:32
struct StackEntry * next
Points to the next older entry in the stack.
Definition: stack.h:33
void * item
The item being held in this entry in the stack.
Definition: stack.h:34