🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3837

Re: initialising arrays

#3837
From: Martin Ambuhl
Date: Thu, 24 Aug 1995 06:09
23 lines
1044 bytes
Gary Barter <gbarter@tsdesign.zynet.co.uk> in <41ccf2$536@sol.zynet.net>
asks:

>I'm using Borland C++ 4.02 and I am looking for a way to make the
>compiler leave an array uninitialised. At present it sets all global
>arrays to zero. This is a problem as I'm using arrays of 2-4 Mbs in size
>which have to be initialized with data when the program is run.
>Is there a way to turn off this auto - initialisation ??

Just declare it as a pointer:

    int *lotsofints;    /* rather than int lotsofints[BIGNUM] */

When you want to use it,

    lotsofints = malloc(BIGNUM * sizeof(int));




--
* Martin Ambuhl       net: mambuhl@ripco.com
* Chicago, IL (USA)    
Technical Details
Message-ID: <DDsx46.5un@rci.ripco.com>
Path: arc1-ca.pugleaf.net!gail.ripco.com!usenet

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!gail.ripco.com!usenet
From: mambuhl@ripco.com (Martin Ambuhl)
Subject: Re: initialising arrays
X-Nntp-Posting-Host: golden.ripco.com
Message-ID: <DDsx46.5un@rci.ripco.com>
Sender: usenet@rci.ripco.com (Net News Admin)
Organization: Ripco Internet BBS Chicago
Date: Thu, 24 Aug 1995 06:09:42 GMT
X-Ident-Sender: mambuhl