Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C rtlib sorting question...
#2
Sure, qsort() takes a callback as argument, so it can be used with pretty much any kind of data, ie (untested):

Code:
function ProjectileCompare cdecl (byref elm1 as Projectile, byref elm2 as Projectile ) as integer

  function = sgn( elm1.dist - elm2.dist )

end function

qsort( myarray, arrayitems, len( Projectile ), @ProjectileCompare )
Reply


Messages In This Thread
C rtlib sorting question... - by Dr_Davenstein - 05-14-2005, 09:34 AM
C rtlib sorting question... - by v3cz0r - 05-14-2005, 08:20 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)