-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstack_peek.c
More file actions
24 lines (21 loc) · 1.1 KB
/
stack_peek.c
File metadata and controls
24 lines (21 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* stack_peek.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mihykim <mihykim@student.42seoul.kr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/03/12 00:44:10 by mihykim #+# #+# */
/* Updated: 2020/03/12 02:46:27 by mihykim ### ########.fr */
/* */
/* ************************************************************************** */
#include "stack.h"
/*
** - Return the data on the top of the given 'stack'.
*/
void *stack_peek(t_stack *stack)
{
if (stack == 0 || stack->max_size == 0 || stack->top_index < 0)
return (0);
return (stack->data[stack->top_index]);
}