### Function

# GLib PtrArray foreach

since: 2.4

#### Declaration

    void
    g_ptr_array_foreach (
      GPtrArray* array,
      GFunc func,
      gpointer user_data
    )

#### Description

Calls a function for each element of a `GPtrArray`. `func` must not add elements to or remove elements from the array.

Available since: 2.4

This function is not directly available to language bindings.

#### Parameters

`array`

  Type: An array of `gpointer`

  A `GPtrArray`.

  The data is owned by the caller of the function.

`func`

  Type: `GFunc`

  The function to call for each array element.

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