delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/30/04:06:46

Message-ID: <390BEB63.675521A7@gtcom.net>
From: Krogg <krogg DOT no DOT to DOT spam AT gtcom DOT net>
X-Mailer: Mozilla 4.61 [en] (Win95; U)
X-Accept-Language: en,en-US,en-GB,ja,af
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Array swapping.
References: <390B75BB DOT 621F846A AT gtcom DOT net> <be7ngssbe6fnhur5if8j27a3ct35gpj2e9 AT 4ax DOT com> <390BAB86 DOT 7C1EF855 AT gtcom DOT net> <390BBCF8 DOT 27D2D2AC AT pop DOT gis DOT net> <390BBF21 DOT 41DAF825 AT gtcom DOT net> <83bt2s3tq8 DOT fsf AT mercury DOT st DOT hmc DOT edu>
Lines: 66
Date: Sun, 30 Apr 2000 04:14:27 -0400
NNTP-Posting-Host: 12.16.179.81
X-Trace: eagle.america.net 957082677 12.16.179.81 (Sun, 30 Apr 2000 04:17:57 EDT)
NNTP-Posting-Date: Sun, 30 Apr 2000 04:17:57 EDT
Organization: 24hoursupport.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Nate Eldredge wrote:
> 
> Krogg <krogg DOT no DOT to DOT spam AT gtcom DOT net> 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.

Cool,I partly grasp the idea,but how do i use the
array?


 
> This should probably go to comp.lang.c, since there's nothing
> DJGPP-specific about it, but oh well.
> 

I thought that the solution might be nonportable and possible
Djgpp specfic,so i posted here.

Thanks by the way for the reply,I am trying to understand it,
but so far i am stuck a little....



-- 


|"""""<`.THE PRINCE ,'>"""""""""""""""""""""""""""""""""""|
|      `.`/""""""\,','            my sig is too big,      |
|SEE HIS (  /   \ \' SEE HIS      but its really cool.    |
| FACE    \/<> <>\/   SMILE                               |
|         /   W   \          Visit my ascii art site:     |
|       ,'\_|||||_/`.  http://www.gtcom.net/~krogg/ascii/ |
|     ,','   |||   `.`.     krogg DOT no DOT to DOT spam AT gtcom DOT net    |
|____<,' TIME TO DIE `.>____Remove no.to.spam to reply____|

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019