Advertisement

new pointers?

Started by September 10, 2000 10:56 AM
0 comments, last by SteveBrown 24 years, 4 months ago
Can I use new to create an array of pointers, then later each pointer will point to an array of objects. For example; int * Pointer; Pointer = new int*[50]; // Above, I want to make an array of pointers dynamically, not objects yet. Pointer[0] = new int[5]; // TRhe above should make the objects, the address stored in Pointer[0] I tried the above and it doesn''t work right, but it is an example of what I want to do. Does someone know how to do this (or what I am trying to do). Thanks for any help!
int** ArrayOfPointers;
ArrayOfPointers = new int*[50];

...

delete [] ArrayOfPointers;

This topic is closed to new replies.

Advertisement