Microsoft KB Archive/28244

= INFO: qsort Can Sort Data Structures Based on Multiple Fields =

Article ID: 28244

Article Last Modified on 7/5/2005

-

APPLIES TO

 The C Run-Time (CRT), when used with:  Microsoft C Professional Development System 6.0a

 Microsoft C Professional Development System 6.0a

 Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 1.5 Professional Edition</li></ul>

 Microsoft Visual C++ 1.0 Professional Edition</li></ul>

 Microsoft Visual C++ 2.0 Professional Edition</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul>

 Microsoft Visual C++ 5.0 Standard Edition</li></ul>

 Microsoft Visual C++ 6.0 Service Pack 5</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q28244

<div class="notice_section">

<div class="summary_section">

SUMMARY
The qsort function in the Microsoft C run-time library does not restrict the methods an application can use to compare items. When qsort compares two data elements, it calls an application-supplied comparison routine.

To sort an array of structures using more than one field as a key, create a comparison function that relates the appropriate fields in each structure and returns a comparison value to indicate the result.

Keywords: kbinfo kbcrt KB28244

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.