The latest version of this topic can be found at Searching and Sorting.
Use the following functions for searching and sorting.
Searching and Sorting Functions
| Function | Search or Sort | .NET Framework equivalent |
|---|---|---|
| bsearch | Binary search | System::Collections::ArrayList::BinarySearch |
| bsearch_s | A more secure version of bsearch. |
System::Collections::ArrayList::BinarySearch |
| _lfind | Linear search for given value | System::Collections::ArrayList::Contains |
| _lfind_s | A more secure version of _lfind |
System::Collections::ArrayList::Contains |
| _lsearch | Linear search for given value, which is added to array if not found | Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples. |
| _lsearch_s | A more secure version of _lsearch |
Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples. |
| qsort | Quick sort | System::Collections::ArrayList::Sort |
| qsort_s | A more secure version of qsort |
System::Collections::ArrayList::Sort |