### Function

# GLib List foreach

#### Declaration

    void
    g_list_foreach (
      GList* list,
      GFunc func,
      gpointer user_data
    )

#### Description

Calls a function for each element of a `GList`.

It is safe for `func` to remove the element from `list`, but it must not modify any part of the list after that element.

This function is not directly available to language bindings.

#### 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.

`func`

  Type: `GFunc`

  The function to call with each element’s data.

`user_data`

  Type: `gpointer`

  User data to pass to the function.

  The argument can be `NULL`.
  The data is owned by the caller of the function.