C
Christopher
I need to have an array of pointers to something. I do not know how
many I will have until runtime. How do you allocate?
Is something like this simple array of int pointers example correct?
class A
{
public:
A()
{
// I know I need 3 pointers to integers here
m_integers = new int * [3];
m_integers[0] = new int(1);
m_integers[1] = new int(2);
m_integers[2] = new int(3);
}
private:
int ** m_integers
};
It needs to be in the form: type **, because the API I am using asks
for it in that way.
many I will have until runtime. How do you allocate?
Is something like this simple array of int pointers example correct?
class A
{
public:
A()
{
// I know I need 3 pointers to integers here
m_integers = new int * [3];
m_integers[0] = new int(1);
m_integers[1] = new int(2);
m_integers[2] = new int(3);
}
private:
int ** m_integers
};
It needs to be in the form: type **, because the API I am using asks
for it in that way.