Posts

Showing posts with the label malloc

how to create dynaimc size of NULL pointers array ?

Image
Clash Royale CLAN TAG #URR8PPP how to create dynaimc size of NULL pointers array ? i want to have dynamic size of array of pointers , how can i do it with malloc? without malloc it look's like this : typedef struct Nodes { UINT_64 Datasequence; UINT_32 Data; struct Nodes* next; }Node; Node * head_ri_interface[2][50] ; wich wil give mi array of [2][50] of null pointers to uninitalized struct's . i have triied to this this like this : void NULLPointerArrayInit(int MAX_LIST_HEAD){ int i = 0 ; for(i = 0; i < 2; i++) { head_ri_interface[i] = (Node *) malloc ( sizeof(Node *) * MAX_LIST_HEAD ); } } but i see that i get that the struct i am pointing at are not NULL . what am i doing wrong ? But head_ri_interface[i] is an array of 50 pointers to your structure? Are you sure you want an array of arrays? – Some programmer dude 1 min ago ...