data_structures
src
data_structures
stack
stack_peek.c
Go to the documentation of this file.
1
/* ************************************************************************** */
3
/* */
4
/* ::: :::::::: */
5
/* stack_peek.c :+: :+: :+: */
6
/* +:+ +:+ +:+ */
7
/* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8
/* +#+#+#+#+#+ +#+ */
9
/* Created: 2020/07/17 00:56:04 by unite #+# #+# */
10
/* Updated: 2020/07/18 16:42:46 by unite ### ########.fr */
11
/* */
12
/* ************************************************************************** */
13
14
#include "
stack.h
"
15
16
void
*
stack_peek
(
const
t_stack
*stack)
17
{
18
return
(
array_get
(stack, stack->
size
- 1));
19
}
stack_peek
void * stack_peek(const t_stack *stack)
Returns the item most recently added to this stack, without removing it.
Definition:
stack_peek.c:16
array_get
void * array_get(const t_array *array, size_t index)
Returns the item at the specified position in this list.
Definition:
array_get.c:16
s_array
A resizable array.
Definition:
array.h:47
s_array::size
size_t size
The number of items in this array.
Definition:
array.h:49
stack.h
Generated by
1.8.16