how to init and malloc array to pointer on C
Posted
by DoronS
on Stack Overflow
See other posts from Stack Overflow
or by DoronS
Published on 2010-03-28T14:07:36Z
Indexed on
2010/03/28
14:13 UTC
Read the original article
Hit count: 257
Hi all,
looks like a memory leak when i try to initializing an array of pointers, this my code:
void initLabelTable(){
register int i;
hashNode** hp;
labelHashTable = (hashNode**) malloc(HASHSIZE*sizeof(hashNode*));
hp = labelHashTable;
for(i=0; i<HASHSIZE; i++) {
*(hp+i) = NULL;
}
}
any idea?
© Stack Overflow or respective owner