ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2011/06/04/09:45:08

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: =?ISO-8859-15?Q?Hans-Bernhard_Br=F6ker?= <HBBroeker AT t-online DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Different memory allocations were to the same location
Date: Sat, 04 Jun 2011 15:20:27 +0200
Lines: 19
Message-ID: <4DEA311B.3090607@t-online.de>
References: <isdadm$amb$1 AT news DOT albasani DOT net>
Mime-Version: 1.0
X-Trace: news.dfncis.de te0kRi2bNVwn17x6Y/jX1w6XY63mX22FNFde5IZ0MXlk//NK7Nhx1s9mW7
Cancel-Lock: sha1:QW9bE4T8I/g4ZQcPG/cVA1CV6cc=
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9
In-Reply-To: <isdadm$amb$1@news.albasani.net>
Bytes: 1659
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 04.06.2011 15:02, Mok-Kong Shen wrote:
> I wrote a function to allocate memory to arrays of integers. But
> it turns out that the the momory allocated was always at the same
> location.

No, it doesn't.  Your test condition is incorrect, leading you an 
incorrect conclusion.

> What had I done improperly and how could I get around
> the problem?

By fixing your program.  I'll drop you a hint: where do you think your 
code writes anything to variables var1 or var2?

> (I use version 2 of the compiler.)

I rather much hope that's a misrepresentation of the facts.  GCC version 
2 is beyond ancient.  So let's hope you meant version 2 of the runtime 
environment instead ...

- Raw text -


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