Function

GLibListnth

Declaration

GList*
g_list_nth (
  GList* list,
  guint n
)

Description

Gets the element at the given position in a GList.

This iterates over the list until it reaches the n-th position. If you intend to iterate over every element, it is better to use a for-loop as described in the GList introduction.

Parameters

list

Type: A list of gpointer

A GList, this must point to the top of the list.

The data is owned by the caller of the function.
n

Type: guint

The position of the element, counting from 0

Return value

Type: A list of gpointer

The element, or NULL if the position is off the end of the GList.

The data is owned by the called function.