Path: utzoo!yunexus!ists!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!uakari.primate.wisc.edu!uwm.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!uxe.cso.uiuc.edu!mcdonald From: mcdonald@uxe.cso.uiuc.edu Newsgroups: comp.lang.c Subject: Re: compare strings, strcmp Message-ID: <225800241@uxe.cso.uiuc.edu> Date: 19 Nov 89 01:38:31 GMT Article-I.D.: uxe.225800241 References: <4463@blake.acs.washington.edu> Lines: 25 Nf-ID: #R:blake.acs.washington.edu:4463:uxe.cso.uiuc.edu:225800241:000:961 Nf-From: uxe.cso.uiuc.edu!mcdonald Nov 18 09:25:00 1989 >I wanted to know what is the best way to compare two strings? >For example, I have the following decl. >char array[10000][200]; >What is the fastest way to sort this array? (I heard that 'strcmp' is slow >if the strings are long. Why?) Someone suggested writing to disk and using an external sort program. That seems a little extreme, especially since the vast majority of routines don't HAVE an external sort routine. The C "qsort" is surely worth a try, otherwise we really should suggest books for him to read. I don't understand the flames about the "unsafe" StrEq macro. Look folks, lots of things are unsafe - motorcycles, steaks, C. For safety you need a toy language. A simple suggestion - is it REALLY too hard to follow? - is to RTFM, which should warn about unsafe uses of functions or macros - or to RTF actual declaration of the macro itself. The question is moot if he calls "qsort", as it requires a function, not a macro. Doug McDonald