delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
X-Recipient: | djgpp AT delorie DOT com |
Date: | Sat, 04 Jun 2011 16:48:08 +0300 |
From: | Eli Zaretskii <eliz AT gnu DOT org> |
Subject: | Re: Different memory allocations were to the same location |
In-reply-to: | <isdadm$amb$1@news.albasani.net> |
X-012-Sender: | halo1 AT inter DOT net DOT il |
To: | djgpp AT delorie DOT com |
Message-id: | <83y61hd7xj.fsf@gnu.org> |
References: | <isdadm$amb$1 AT news DOT albasani DOT net> |
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 |
> From: Mok-Kong Shen <mok-kong DOT shen AT t-online DOT de> > Date: Sat, 04 Jun 2011 15:02:58 +0200 > Bytes: 1846 > > 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. What had I done improperly and how could I get around > the problem? (I use version 2 of the compiler.) In generateintvec, you free the memory allocated by the previous call, so the same address is now available for reuse. Therefore calloc happily reuses it. Why is that a problem?
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |