Skip to content

Commit 5984f9b

Browse files
authored
Merge pull request #3236 from TylerMSFT/twhitney-github2303
add note about stability
2 parents dba8154 + 4423965 commit 5984f9b

File tree

1 file changed

+16
-15
lines changed
  • docs/c-runtime-library/reference

1 file changed

+16
-15
lines changed

docs/c-runtime-library/reference/qsort.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: "qsort"
3-
ms.date: "4/2/2020"
3+
description: "Describes the Microsoft C runtime quick sort API `qsort`"
4+
ms.date: "10/23/2020"
45
api_name: ["qsort", "_o_qsort"]
56
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ntdll.dll", "ucrtbase.dll", "api-ms-win-crt-utility-l1-1-0.dll", "ntoskrnl.exe", "api-ms-win-crt-private-l1-1-0.dll"]
67
api_type: ["DLLExport"]
@@ -26,23 +27,23 @@ void qsort(
2627

2728
### Parameters
2829

29-
*base*<br/>
30+
*`base`*\
3031
Start of target array.
3132

32-
*number*<br/>
33+
*`number`*\
3334
Array size in elements.
3435

35-
*width*<br/>
36+
*`width`*\
3637
Element size in bytes.
3738

38-
*compare*<br/>
39+
*`compare`*\
3940
Pointer to a user-supplied routine that compares two array elements and returns a value that specifies their relationship.
4041

4142
## Remarks
4243

43-
The **qsort** function implements a quick-sort algorithm to sort an array of *number* elements, each of *width* bytes. The argument *base* is a pointer to the base of the array to be sorted. **qsort** overwrites this array by using the sorted elements.
44+
The **`qsort`** function implements a quick-sort algorithm to sort an array of *`number`* elements, each of *`width`* bytes. The argument *`base`* is a pointer to the base of the array to be sorted. **`qsort`** overwrites this array by using the sorted elements.
4445

45-
**qsort** calls the *compare* routine one or more times during the sort, and passes pointers to two array elements on each call.
46+
**`qsort`** calls the *`compare`* routine one or more times during the sort, and passes pointers to two array elements on each call. If *`compare`* indicates two elements are the same, their order in the resulting sorted array is unspecified.
4647

4748
```C
4849
compare( (void *) & elem1, (void *) & elem2 );
@@ -52,21 +53,21 @@ The routine compares the elements and returns one of the following values.
5253
5354
|Compare function return value|Description|
5455
|-----------------------------------|-----------------|
55-
|< 0|**elem1** less than **elem2**|
56-
|0|**elem1** equivalent to **elem2**|
57-
|> 0|**elem1** greater than **elem2**|
56+
|< 0|**`elem1`** less than **`elem2`**|
57+
|0|**`elem1`** equivalent to **`elem2`**|
58+
|> 0|**`elem1`** greater than **`elem2`**|
5859
5960
The array is sorted in increasing order, as defined by the comparison function. To sort an array in decreasing order, reverse the sense of "greater than" and "less than" in the comparison function.
6061
61-
This function validates its parameters. If *compare* or *number* is **NULL**, or if *base* is **NULL** and *number* is nonzero, or if *width* is less than zero, the invalid parameter handler is invoked, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, the function returns and **errno** is set to **EINVAL**.
62+
This function validates its parameters. If *`compare`* or *`number`* is **`NULL`**, or if *`base`* is **`NULL`** and *`number`* is nonzero, or if *`width`* is less than zero, the invalid parameter handler is invoked, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, the function returns and **`errno`** is set to **`EINVAL`**.
6263
6364
By default, this function's global state is scoped to the application. To change this, see [Global state in the CRT](../global-state.md).
6465
6566
## Requirements
6667
6768
|Routine|Required header|
6869
|-------------|---------------------|
69-
|**qsort**|\<stdlib.h> and \<search.h>|
70+
|**`qsort`**|\<stdlib.h> and \<search.h>|
7071
7172
For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
7273
@@ -116,6 +117,6 @@ boy deserves every favor good
116117

117118
## See also
118119

119-
[Searching and Sorting](../../c-runtime-library/searching-and-sorting.md)<br/>
120-
[bsearch](bsearch.md)<br/>
121-
[_lsearch](lsearch.md)<br/>
120+
[Searching and Sorting](../../c-runtime-library/searching-and-sorting.md)\
121+
[`bsearch`](bsearch.md)\
122+
[`_lsearch`](lsearch.md)

0 commit comments

Comments
 (0)