Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #13092

Re: qsort

From John Gordon <gordon@panix.com>
Newsgroups comp.lang.c
Subject Re: qsort
Date 2011-11-11 15:20 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <j9jefb$9ag$1@reader1.panix.com> (permalink)
References <4ebd2a87$0$19698$bbae4d71@news.suddenlink.net>

Show all headers | View raw


In <4ebd2a87$0$19698$bbae4d71@news.suddenlink.net> "Bill Cunningham" <nospam@nspam.invalid> writes:

>     Seeing that in that last paramter of qsort and int is returned I guess 
> you could pass NULL to that parameter. Would you want to do that.

No, you would not want to pass NULL.  The purpose of that parameter is so
you can pass a pointer to a function that compares two of your data
elements.  If you pass NULL, qsort has no way to compare the elements.

> ... what kind of function would I want to write to pass to that last
> parameter of qsort?

If you knew the parameter was for passing in a comparison function, why did
you ask about passing NULL?

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

qsort "Bill Cunningham" <nospam@nspam.invalid> - 2011-11-11 09:00 -0500
  Re: qsort Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-11 06:56 -0800
    Re: qsort Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-11 16:39 +0000
      Re: qsort 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-12 10:19 -0800
  Re: qsort John Gordon <gordon@panix.com> - 2011-11-11 15:20 +0000
    Re: qsort "Bill Cunningham" <nospam@nspam.invalid> - 2011-11-11 14:22 -0500
  Re: qsort pete <pfiland@mindspring.com> - 2011-11-11 20:27 -0500
    Re: qsort "Bill Cunningham" <nospam@nspam.invalid> - 2011-11-12 19:10 -0500
      Re: qsort Keith Thompson <kst-u@mib.org> - 2011-11-12 16:40 -0800
        Re: qsort "Bill Cunningham" <nospam@nspam.invalid> - 2011-11-13 01:39 -0500
          Re: qsort Ian Collins <ian-news@hotmail.com> - 2011-11-13 19:51 +1300
            Re: qsort Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-14 02:14 +0200
            Re: qsort Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-14 00:43 -0800
      Re: qsort pete <pfiland@mindspring.com> - 2011-11-12 22:42 -0500

csiph-web