home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!cbnewsc!cbfsb!att-out!pacbell.com!iggy.GW.Vitalink.COM!lll-winken!taurus!taygeta.oc.nps.navy.mil!skip
- From: skip@taygeta.oc.nps.navy.mil (Skip Carter)
- Newsgroups: comp.lang.c++
- Subject: Re: 'new' syntax?
- Keywords: pointer new syntax
- Message-ID: <6995@taurus.cs.nps.navy.mil>
- Date: 16 Nov 92 21:42:52 GMT
- References: <1992Nov13.095152.26819@rs6000.bham.ac.uk>
- Sender: news@taurus.cs.nps.navy.mil
- Reply-To: skip@taygeta.oc.nps.navy.mil (Skip Carter)
- Lines: 21
-
- In article <1992Nov13.095152.26819@rs6000.bham.ac.uk>, pickerig@eee.bham.ac.uk (Mr. G. Pickering) writes:
- |> I want to create an array of 'size' long**, is the correct syntax:
- |>
- |> long*** new_blocks = new (long**[size]);
- |>
- |> I am having memory corruption problems and suspect this is not doing
- |> what I really want.
- |>
-
- long **new_blocks = new long *[size];
-
- // to allocate space that each new_block[] points to,
- for (int k = 0; k < size; k++)
- new_blocks[k] = new long[block_size];
-
-
- --
- Everett (Skip) Carter Phone: 408-646-3318 FAX: 408-646-2712
- Naval Postgraduate School INTERNET: skip@taygeta.oc.nps.navy.mil
- Dept. of Oceanography, Code OC/CR UUCP: ...!uunet!taygeta!skip
- Monterey, CA. 93943 TELEMAIL: s.carter/omnet
-