Bug 252547 - [PATCH] Fix an example to qsort.3
Summary: [PATCH] Fix an example to qsort.3
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-01-09 21:27 UTC by Hodong
Modified: 2021-01-09 22:09 UTC (History)
1 user (show)

See Also:

patch for qsort.3 example (646 bytes, patch)
2021-01-09 21:27 UTC, Hodong
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hodong 2021-01-09 21:27:54 UTC
Created attachment 221431 [details]
patch for qsort.3 example

There seems to be a bug in the example in qsort.3.
Please review the following.
Thank you.

diff --git a/lib/libc/stdlib/qsort.3 b/lib/libc/stdlib/qsort.3
index 606185f9baee..22a0735af3a0 100644
--- a/lib/libc/stdlib/qsort.3
+++ b/lib/libc/stdlib/qsort.3
@@ -322,7 +322,7 @@ main(void)
        size_t array_size = sizeof(int_array) / sizeof(int_array[0]);
        size_t k;
-       qsort(&int_array, array_size, sizeof(int_array[0]), int_compare);
+       qsort(int_array, array_size, sizeof(int_array[0]), int_compare);
        for (k = 0; k < array_size; k++)
                printf(" %d", int_array[k]);
Comment 1 Hodong 2021-01-09 22:09:39 UTC
I was wrong. Sorry.