Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > qsort problem
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 13 Topic 25380 of 27670
Post > Topic >>

qsort problem

by istillshine@[EMAIL PROTECTED] Apr 5, 2008 at 06:27 PM

I called qsort (from standard library) somewhere in my function.

qsort(temp, tree_num, sizeof(int), compare);

I defined compare before the caller in the same .c file.

int compare(const int *a, const int *b)
{
  int val1, val2;

  val1 = *a;
  val2 = *b;

  return (val1 > val2) ? -1 : ((val1 < val2) ? 1 : 0);
}


When compiling, I got this warning:

passing arg 4 of `qsort' from incompatible pointer type

I really could not find out why compare is incompatible.
 




 13 Posts in Topic:
qsort problem
istillshine@[EMAIL PROTEC  2008-04-05 18:27:52 
Re: qsort problem
Ioannis Vranos <ivrano  2008-04-06 04:37:27 
Re: qsort problem
istillshine@[EMAIL PROTEC  2008-04-05 18:45:14 
Re: qsort problem
Ioannis Vranos <ivrano  2008-04-06 04:48:39 
Re: qsort problem
Ioannis Vranos <ivrano  2008-04-06 05:04:17 
Re: qsort problem
Ioannis Vranos <ivrano  2008-04-06 05:06:55 
Re: qsort problem
Barry Schwarz <schwarz  2008-04-06 00:04:13 
Re: qsort problem
istillshine@[EMAIL PROTEC  2008-04-13 05:10:15 
Re: qsort problem
Ioannis Vranos <ivrano  2008-04-13 15:31:18 
Re: qsort problem
Keith Thompson <kst-u@  2008-04-13 08:35:10 
Re: qsort problem
Barry Schwarz <schwarz  2008-04-13 16:03:07 
Re: qsort problem
Harald van =?UTF-8?b?RMSz  2008-04-13 14:31:18 
Re: qsort problem
istillshine@[EMAIL PROTEC  2008-04-13 07:25:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 22:06:33 CDT 2008.