Dynamic sized array of pointers
what programming language are you using?
if c++, use the STL vector class:
vector <variableType *>;
do a google search for "STL tutorial" for info on using the STL. there may also be some tutorials on this site.
if java, use the built in Vector class. (you can look up the functions and whatnot on java.sun.com. look for the API documentation for whatever version of java you are using.
if you want to go the reinvent the wheel method, read about Linked Lists (some form of google search should land you a nice tutorial on that subject)
-me
[edited by - Palidine on July 28, 2003 10:00:16 PM]
if c++, use the STL vector class:
vector <variableType *>;
do a google search for "STL tutorial" for info on using the STL. there may also be some tutorials on this site.
if java, use the built in Vector class. (you can look up the functions and whatnot on java.sun.com. look for the API documentation for whatever version of java you are using.
if you want to go the reinvent the wheel method, read about Linked Lists (some form of google search should land you a nice tutorial on that subject)
-me
[edited by - Palidine on July 28, 2003 10:00:16 PM]
Thanks, I didn''t want to have all that extra garbage for a buncha pointers, but I guess I have no choice.
Pat - Ex nihilo nihilus
Pat - Ex nihilo nihilus
If you mean dynamic by creating an array of a non-constant size but only once, you can do something like
int* array = new int[size];
Be sure to call delete[] on it when you are done.
int* array = new int[size];
Be sure to call delete[] on it when you are done.
Thats exactly what I mean, but I need an array of pointers, not an array of objects on the freestore.
Pat - Ex nihilo nihilus
Pat - Ex nihilo nihilus
a pointer is just another object..
typedef int* IntPointer;
IntPointer* intPointers = new IntPointer[sizeOfIntPointerArray];
and vector<int*> doesn''t really have overhead if used right.
"take a look around" - limp bizkit
www.google.com
typedef int* IntPointer;
IntPointer* intPointers = new IntPointer[sizeOfIntPointerArray];
and vector<int*> doesn''t really have overhead if used right.
"take a look around" - limp bizkit
www.google.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement