X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: =?ISO-8859-15?Q?Hans-Bernhard_Br=F6ker?= 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: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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: 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 Precedence: bulk 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 ...