This is my structure :
struct HashTable{
int tsize;
int count; //No. of elements in table
struct HashTableNode **Table;
};
And this is what I am trying to do :
struct HashTable *h=(struct HashTable *)malloc(sizeof(struct HashTable));
if(!h) return NULL;
h->tsize=size/LOAD_FACTOR;
h->count=0;
h->Table=(struct HashTableNode**)malloc(sizeof(HashTableNode *)*h->tsize);//this line
I am unable to convert the last line into its equivalent C++ version using new operator
Solved it
i changed the code to this :
h->Table=new HashTableNode*[h->tsize];
for(int i=0;i<h->tsize;i++)
h->Table[i]=new HashTableNode;
and did a little debugging on my own and voila. It is solved.
Thanks, everyone.