Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!bellcore!faline!ulysses!allegra!alice!ark From: ark@alice.UUCP Newsgroups: comp.unix.wizards Subject: Re: Why doesn't this qsort example work? Message-ID: <7377@alice.UUCP> Date: Mon, 19-Oct-87 13:49:25 EDT Article-I.D.: alice.7377 Posted: Mon Oct 19 13:49:25 1987 Date-Received: Wed, 21-Oct-87 00:16:40 EDT References: <7527@g.ms.uky.edu> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 14 Keywords: argh, frustration, core dump In article <7527@g.ms.uky.edu>, sean@ukma.UUCP writes: > I'm trying to use qsort(3) for the first time and I'm having a bit of > trouble. I've included some code here that reproduces the problem. > /* this sorts t[] by the "a" field */ > qsort(&t[0], 2, sizeof(struct tstr), (*compar)()); Try qsort(&t[0], 2, sizeof(struct tstr), compar); As you wrote it, you're calling compar with no arguments. Presto, instant core dump!