data_structures
list_peek_last.c
Go to the documentation of this file.
1 /* ************************************************************************** */
3 /* */
4 /* ::: :::::::: */
5 /* list_peek_last.c :+: :+: :+: */
6 /* +:+ +:+ +:+ */
7 /* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8 /* +#+#+#+#+#+ +#+ */
9 /* Created: 2020/07/16 23:07:06 by unite #+# #+# */
10 /* Updated: 2020/07/18 16:36:44 by unite ### ########.fr */
11 /* */
12 /* ************************************************************************** */
13 
14 #include "list.h"
15 
16 void *list_peek_last(const t_list *alst)
17 {
18  if (alst->size == 0)
19  return (NULL);
20  return (alst->tail->content);
21 }
list_peek_last
void * list_peek_last(const t_list *alst)
Returns the last item in the list.
Definition: list_peek_last.c:16
s_list
Doubly-linked list of generic items.
Definition: list.h:54
s_list::tail
t_link * tail
The last link.
Definition: list.h:57
s_list::size
size_t size
The number of items in the list.
Definition: list.h:58
list.h