示例#1
0
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);
}
示例#2
0
void *stack_top(t_stack stack) {
    return list_get_elem_at_front(stack);
}
示例#3
0
void *queue_front(t_queue queue) {
	return list_get_elem_at_front(queue);
}