🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #369

Re: Re-dimension arrays

#369
From: Lynn Killingbeck
Date: Tue, 29 Jun 1999 00:00
22 lines
1633 bytes
Magnus Hult wrote:
> 
> Hi there,
> 
> is there anyway to redimension an array without deleting stuff that's
> already in it (something like VB's "ReDim Preserve")?
> 
> I know it's possible to do this:
> int array[1];
> array[17] = 1234;
> but can I be sure no important data are being overwritten?
> 
> thanks
> Magnus Hult
> hult.holmstrom@swipnet.se
> http://www.ovenproof.com

You might see if the alloc() family has something useful to you. Get the
memory via alloc() or calloc() or realloc() initially, rather than via
int array[...], in this case. Use realloc() to change the size.

Lynn Killingbeck
Technical Details
Message-ID: <3779801D.1966@phoenix.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <WUbe3.540$nZ5.877@nntpserver.swip.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f8d38,51beb6ad66d52548
X-Google-Attributes: gidf8d38,public
X-Google-Thread: 114592,51beb6ad66d52548
X-Google-Attributes: gid114592,public
X-Google-Thread: 109fba,51beb6ad66d52548
X-Google-Attributes: gid109fba,public
From: Lynn Killingbeck <killbeck@phoenix.net>
Subject: Re: Re-dimension arrays
Date: 1999/06/29
Message-ID: <3779801D.1966@phoenix.net>
X-Deja-AN: 495437985
Content-Transfer-Encoding: 7bit
References: <WUbe3.540$nZ5.877@nntpserver.swip.net>
Content-Type: text/plain; charset=us-ascii
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
X-Complaints-To: abuse@GigaNews.Com
X-Trace: sv1-C5uw4VxoARtWAQr703AE6LCnccStVMsu4zvxAtm5pUmUUscUhDtlvEX/uaPnb7V1C7NKhIODZX2pBmQ!JZW9hsEYFjIp
Organization: Re-Tired
MIME-Version: 1.0
Reply-To: killbeck@phoenix.net
NNTP-Posting-Date: Tue, 29 Jun 1999 21:23:20 CDT
Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cpp.language,comp.lang.c++