By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,148 Members | 1,409 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,148 IT Pros & Developers. It's quick & easy.

arrays that store pointers

P: n/a
I want to be create an array that stores pointers to objects of a type
that I have created in my program. How do I do this and avoid using a
dynamic array?

Basically I have a pointer to a vertex and I want to store it in an
array that holds pointers to vertices. That is the gist of what I am
trying to do.

Thanks.

Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
us**@domain.invalid wrote:
I want to be create an array that stores pointers to objects of a type
that I have created in my program. How do I do this and avoid using a
dynamic array?
If you know how many pointers you need, you just declare the array:

the_type_you_created *pointerarray[howmany];

'howmany' has to be a compile-time constant expression. The array is
not dynamic, but instead is either automatic or static or a member of
another object (and the storage duration is determined by the object).
Basically I have a pointer to a vertex and I want to store it in an
array that holds pointers to vertices. That is the gist of what I am
trying to do.


I see no problem. Perhaps I don't understand fully what you're trying
to accomplish...

V
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.