Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
** EPITECH PROJECT, 2024 |
3 |
|
|
** template |
4 |
|
|
** File description: |
5 |
|
|
** The my_pop_back.c |
6 |
|
|
*/ |
7 |
|
|
/** |
8 |
|
|
* @file my_pop_back.c |
9 |
|
|
* @brief The my_pop_back.c |
10 |
|
|
* @author Nicolas TORO |
11 |
|
|
*/ |
12 |
|
|
|
13 |
|
|
#include "mylist.h" |
14 |
|
|
|
15 |
|
✗ |
linked_list_t *my_pop_back(linked_list_t **begin) |
16 |
|
|
{ |
17 |
|
✗ |
linked_list_t *tmp = *begin; |
18 |
|
|
|
19 |
|
✗ |
if (*begin == NULL) |
20 |
|
✗ |
return NULL; |
21 |
|
✗ |
for (; tmp->next != NULL; tmp = tmp->next); |
22 |
|
✗ |
if (tmp->prev != NULL) |
23 |
|
✗ |
tmp->prev->next = NULL; |
24 |
|
|
else |
25 |
|
✗ |
*begin = NULL; |
26 |
|
✗ |
return tmp; |
27 |
|
|
} |
28 |
|
|
|