Thread: 3D Array

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    23

    Question 3D Array

    Is anybody know how to create a 3 dimentional dynamic array without using new and malloc? This array should grow automatically when we add an item.


    Thanks,
    Alextrons
    If they can, why can't I...

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    if you want it to shrink and grow automatically you will have to use malloc or new.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    23
    No! I found already what I really want and this is the link:

    http://www.codeproject.com/cpp/extcol.asp#xx29237xx

    however, I don't think it will run in Windows9x.

    malloc and new are good only for known size of array.

    fyi,
    Alextrons
    If they can, why can't I...

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    While the solution is probably better suited to your needs, you should be aware, that without some method of memory allocation at runtime ( new, malloc, calloc, realloc ), dynamically growing data is impossible to manage. At the moment, you still use new. You just don't notice, because it is wrapped in one more layer of classes.


    >malloc and new are good only for known size of array

    new needs a variable with a set value. But you know the size at runtime. It starts at zero, and every time you add one, you have one element more.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    23
    So meaning all dynamic class array ex. CArray, CObArray, etc. are probably created using new, malloc, calloc, & realloc and probably the one who created it is expert using it?


    Thanks for the info,
    Alextrons
    If they can, why can't I...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 3D Array of Bool
    By cybernike in forum C++ Programming
    Replies: 37
    Last Post: 06-28-2007, 11:17 AM
  2. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  3. Urgent help on 3d Array
    By despoil in forum C Programming
    Replies: 16
    Last Post: 05-19-2002, 04:06 PM
  4. 3D array
    By GSLR in forum C Programming
    Replies: 2
    Last Post: 05-12-2002, 04:00 PM
  5. Dynamic 3D array allocation
    By Vulcan in forum C++ Programming
    Replies: 4
    Last Post: 11-21-2001, 02:51 AM