Hi,
I need to implement a dynamic array of pointers to structures.Here's what I've done
struct node{
int freq;
node *lptr;
node *rptr;
};
class M
{
private:
node **A;
int length;
public:
M()
{
length=10;
A=new node*[10];
}
M(int a)
{
length=a;
A=new node*[a];
}
Firstly, am I right?
Now when I use this in a function..
int i;
for(i=0;i<length;i++)
A[i]->freq=i;
I get Segmentation Fault.I'm pretty sure im mucking up pointers somewhere.Any help?