void *list_get_elem_at_position(t_list list, unsigned int position) { t_list tmp; unsigned int i; i = 0; tmp = list; if (list == NULL) return (NULL); if (position == 0) { return (list_get_elem_at_front(list)); } if (position > list_get_size(list)) return (NULL); while (tmp->next && i < position) { tmp = tmp->next; i++; } if (tmp != NULL) return (tmp->value); return (NULL); }
void *stack_top(t_stack stack) { return list_get_elem_at_front(stack); }
void *queue_front(t_queue queue) { return list_get_elem_at_front(queue); }