### Function

# GLib PtrArray extend

since: 2.62

#### Declaration [src]

    void
    g_ptr_array_extend (
      GPtrArray* array_to_extend,
      GPtrArray* array,
      GCopyFunc func,
      gpointer user_data
    )

#### Description [src]

Adds all pointers of `array` to the end of the array `array_to_extend`. The array will grow in size automatically if needed. `array_to_extend` is modified in-place.

`func`, as a `GCopyFunc`, takes two arguments, the data to be copied and a `user_data` pointer. On common processor architectures, it’s safe to pass `NULL` as `user_data` if the copy function takes only one argument. You may get compiler warnings from this though if compiling with GCC’s `-Wcast-function-type` warning.

If `func` is `NULL`, then only the pointers (and not what they are pointing to) are copied to the new `GPtrArray`.

Whether `array_to_extend` is `NULL` terminated stays unchanged by this function.

Available since: 2.62

This function is not directly available to language bindings.

#### Parameters

`array_to_extend`

  Type: An array of `gpointer`

  A `GPtrArray`.

  The data is owned by the caller of the function.

`array`

  Type: An array of `gpointer`

  A `GPtrArray` to add to the end of `array_to_extend`.

  The data is owned by the caller of the function.

`func`

  Type: `GCopyFunc`

  A copy function used to copy every element in the array.

`user_data`

  Type: `gpointer`

  User data passed to the copy function `func`, or `NULL`.

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