Buff
New member
alright.....help!!!
I need to create an array of pointers to objects in C++
like so:
anObject *ptr;
ptr = new anObject[5];
but it needs to be an array of pointers to that object, not an array of that object.
I tried :
(note: col is an arbitrary number)
Node **ptrArrayAcross;
ptrArrayAcross = new int[cols];
for( int i = 0; i < cols; i++ ){
Node newNode = new Node( -1, i, 0, 0);
ptrArrayAcross = newNode;
}
tons of errors
help?
I need to create an array of pointers to objects in C++
like so:
anObject *ptr;
ptr = new anObject[5];
but it needs to be an array of pointers to that object, not an array of that object.
I tried :
(note: col is an arbitrary number)
Node **ptrArrayAcross;
ptrArrayAcross = new int[cols];
for( int i = 0; i < cols; i++ ){
Node newNode = new Node( -1, i, 0, 0);
ptrArrayAcross = newNode;
}
tons of errors
help?