Skip to main content
gamedev.net
🔒 Locked

declaring dynamic array of pointers

Started by InetRoadkill Feb 17, 2007 at 6:54 PM 0 replies 550+ views
Original Post
InetRoadkill
InetRoadkill
I'm not seeing the problem with this. I want to declare an array of pointers that can be dynamically allocated. Here's the code:

CBSPNode **LeafArray;

MyFunc()
{
   // allocate space for array of leaf pointers
   LeafArray = (CBSPNode **) malloc(leaf_number * sizeof(CBSPNode **));
...
   // store pointer in array
   LeafArray[pPortal->m_iLeafId] = pPortal->m_pNode; <--- error happens here
}
The compiler complains with: "error C2107: illegal index, indirection not allowed" Ok, what's wrong here? The double asterisk is supposed to declare an array of pointers. This works just fine with **argv. I'm stumped.
InetRoadkill
InetRoadkill
Ooops, never mind. I found a typo that was causing the error.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.