예제 #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
파일: queue.c 프로젝트: 78boum/C---Epitech
void *queue_front(t_queue queue) {
	return list_get_elem_at_front(queue);
}