### Function

# GLib qsort_with_data

since: 2.0

#### Declaration

    void
    g_qsort_with_data (
      gconstpointer pbase,
      gint total_elems,
      gsize size,
      GCompareDataFunc compare_func,
      gpointer user_data
    )

#### Description

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

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

Available since: 2.0

#### Parameters

`pbase`

  Type: `gconstpointer`

  Start of array to sort.

  The data is owned by the caller of the function.

`total_elems`

  Type: `gint`

  Elements in the array.

`size`

  Type: `gsize`

  Size of each element.

`compare_func`

  Type: `GCompareDataFunc`

  Function to compare elements.

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