### Function

# GLib Array sort_with_data

#### Declaration

    void
    g_array_sort_with_data (
      GArray* array,
      GCompareDataFunc compare_func,
      gpointer user_data
    )

#### Description

Like g_array_sort(), but the comparison function receives an extra user data argument.

This is guaranteed to be a stable sort since version 2.32.

There used to be a comment here about making the sort stable by using the addresses of the elements in the comparison function. This did not actually work, so any such code should be removed.

This function is not directly available to language bindings.

#### Parameters

`array`

  Type: An array of `gpointer`

  A `GArray`.

  The data is owned by the caller of the function.

`compare_func`

  Type: `GCompareDataFunc`

  Comparison function.

`user_data`

  Type: `gpointer`

  Data to pass to `compare_func`.

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