data_structures
max_pq_peek.c
Go to the documentation of this file.
1 /* ************************************************************************** */
3 /* */
4 /* ::: :::::::: */
5 /* max_pq_peek.c :+: :+: :+: */
6 /* +:+ +:+ +:+ */
7 /* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8 /* +#+#+#+#+#+ +#+ */
9 /* Created: 2020/07/17 01:50:22 by unite #+# #+# */
10 /* Updated: 2020/07/17 19:17:18 by unite ### ########.fr */
11 /* */
12 /* ************************************************************************** */
13 
14 #include "max_pq.h"
15 
16 void *max_pq_peek(const t_max_pq *pq)
17 {
18  if (array_size(pq) == 0)
19  return (NULL);
20  return (array_get(pq, 0));
21 }
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
max_pq.h
array_size
size_t array_size(const t_array *array)
Returns the number of elements in this array.
Definition: array_size.c:16
s_array
A resizable array.
Definition: array.h:47
max_pq_peek
void * max_pq_peek(const t_max_pq *pq)
Returns the largest key in the queue.
Definition: max_pq_peek.c:16