home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11381 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  1.1 KB

  1. Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!maccs.dcss.mcmaster.ca!langtonk
  2. From: langtonk@maccs.dcss.mcmaster.ca
  3. Newsgroups: comp.lang.c++
  4. Date: 17 Jul 92 22:25 MDT
  5. Subject: help on dynamic multidim. array in 
  6. Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
  7. Message-ID: <1992Jul17.182514.24651@maccs.dcs>
  8. Nf-ID: #N:1992Jul17.182514.24651@maccs.dcs:1510041107:001:714
  9. Nf-From: maccs.dcss.mcmaster.ca!langtonk    Jul 17 22:25:00 1992
  10. Lines: 28
  11.  
  12.  
  13. I am trying to dynamically allocate a two dimensional array using
  14. the command "new" in Borland C++ version 2.0. The idea is that I want
  15. to be able to change the size of the array at any time within the 
  16. program and I don't know the array size ahead of time. As an example
  17. I have tried the following:
  18.  
  19. int *arr;
  20.  
  21. arr = new int [10][5]
  22.  
  23. This gives the following error message:
  24.  
  25. Cannot assign 'int[5] far *' to 'int far *'
  26.  
  27. The Borland C++ Programmers Guide has the following example of page 111:
  28.  
  29. mat_ptr = new int [3][10][12]
  30.  
  31. but it does not give the data type for mat_ptr. Does anyone know how to
  32. make this work? Any advice would be greatly appreciated. 
  33.  
  34. Many Thanks.
  35.  
  36. Joseph Ho
  37.  
  38. langtonk@maccs.dcss.mcmaster.ca
  39.  
  40.