home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16501 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.3 KB

  1. 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
  2. From: skip@taygeta.oc.nps.navy.mil (Skip Carter)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: 'new' syntax?
  5. Keywords: pointer new syntax
  6. Message-ID: <6995@taurus.cs.nps.navy.mil>
  7. Date: 16 Nov 92 21:42:52 GMT
  8. References: <1992Nov13.095152.26819@rs6000.bham.ac.uk>
  9. Sender: news@taurus.cs.nps.navy.mil
  10. Reply-To: skip@taygeta.oc.nps.navy.mil (Skip Carter)
  11. Lines: 21
  12.  
  13. In article <1992Nov13.095152.26819@rs6000.bham.ac.uk>, pickerig@eee.bham.ac.uk (Mr. G. Pickering) writes:
  14. |> I want to create an array of 'size' long**, is the correct syntax:
  15. |> 
  16. |>   long*** new_blocks = new (long**[size]);
  17. |> 
  18. |> I am having memory corruption problems and suspect this is not doing
  19. |> what I really want.
  20. |> 
  21.  
  22.     long **new_blocks = new long *[size];
  23.  
  24.     // to allocate space that each new_block[] points to,
  25.     for (int k = 0; k < size; k++)
  26.         new_blocks[k] = new long[block_size];
  27.  
  28.  
  29. -- 
  30.  Everett (Skip) Carter             Phone:  408-646-3318 FAX: 408-646-2712
  31.  Naval Postgraduate School         INTERNET: skip@taygeta.oc.nps.navy.mil
  32.  Dept. of Oceanography, Code OC/CR  UUCP:     ...!uunet!taygeta!skip
  33.  Monterey, CA. 93943               TELEMAIL: s.carter/omnet
  34.