RE: [Dev-C++] dynamic allocation and structs
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2002-10-25 14:06:29
|
On Fri, 25 Oct 2002, Ioannis Vranos wrote: > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Per Westermark > > Sent: Friday, October 25, 2002 1:54 PM > > To: Ioannis Vranos > > Cc: Dev-C++ Mailing List > > Subject: RE: [Dev-C++] dynamic allocation and structs > > > > > > Exactly why my previous mail specified use-cases. > > > > - Sparse matrix, where a lot of entries are NULL. > > - Quick sort, since it's enough to move the pointers. > > > As far as i can think of it, you can't use qsort() though. qsort() > copies the elements and in addition, you can't compare pointers not > pointing inside the same array. So you have to define your own > facilities. As already posted, a compilable example with qsort. qsort think the pointers are the elements, so the sort isn't a problem. All you have to think about in your compare function, is that you don't get pointers to your elements, but pointers to pointers to your elements. > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL: http://run.to/noicys > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |