GLib.sort_array
Description: Reference for GLib.sort_array

### Function

# GLibsort_array

since: 2.82

#### Declaration [src]

    void
    g_sort_array (
      void* array,
      size_t n_elements,
      size_t element_size,
      GCompareDataFunc compare_func,
      void* user_data
    )

#### Description [src]

This is just like the standard C `qsort()` function, but the comparison routine accepts a user data argument (like `qsort_r()`).

Unlike `qsort()`, this is guaranteed to be a stable sort.

Available since: 2.82

This function is not directly available to language bindings.

#### Parameters

`array`

  Type: An array of `void`

  Start of array to sort.

  The length of the array is specified in the `n_elements` argument.
  The data is owned by the caller of the function.

`n_elements`

  Type: `size_t`

  Number of elements in the array.

`element_size`

  Type: `size_t`

  Size of each element.

`compare_func`

  Type: `GCompareDataFunc`

  Function to compare elements.

`user_data`

  Type: `void*`

  Data to pass to `compare_func`.

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