From: Nate Eldredge Newsgroups: comp.os.msdos.djgpp Subject: Re: Array swapping. Date: 30 Apr 2000 00:58:55 -0700 Organization: InterWorld Communications Lines: 43 Message-ID: <83bt2s3tq8.fsf@mercury.st.hmc.edu> References: <390B75BB DOT 621F846A AT gtcom DOT net> <390BAB86 DOT 7C1EF855 AT gtcom DOT net> <390BBCF8 DOT 27D2D2AC AT pop DOT gis DOT net> <390BBF21 DOT 41DAF825 AT gtcom DOT net> NNTP-Posting-Host: mercury.st.hmc.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: nntp1.interworld.net 957081535 42565 134.173.45.219 (30 Apr 2000 07:58:55 GMT) X-Complaints-To: usenet AT nntp1 DOT interworld DOT net NNTP-Posting-Date: 30 Apr 2000 07:58:55 GMT User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Krogg writes: > Joseph Rose wrote: > > > > Try: > > > > void Swap (void* A, void* B) > > { > > void* i=A > > A=B > > B=i > > return; > > } > > Just for fun i tried this. [snip] > This is the output: > 59.720001 > 0.000000 > > so,IT DON'T WERK........ > > > The real problem in this is that i need to > change the value of a constant pointer... > > There has to be a way to do this. The solution is to make it not constant. Instead of `float foo[40][50]', you could do: float (*foo)[50]; foo = malloc(40 * sizeof(*foo)); You can then throw the pointers around as desired. This should probably go to comp.lang.c, since there's nothing DJGPP-specific about it, but oh well. -- Nate Eldredge neldredge AT hmc DOT edu