I have some issue with programming in C. I have a structrure, that goes like
typedef struct Hash_Funct{
char* name;
Var_Table * List_of_Variables; ///pointer to list of variables
} Hash_Funct;
And in certain point of code, I want to inicialize the structure with:
Hash_Funct tmp = (Hash_Funct*) malloc(sizeof(Hash_Funct));
tmp->name=name;
Init_ID_Table(tmp->List_of_Variables);
Where the Init_ID_Table(); is defined as:
void Init_ID_Table(Var_Table *table){
table = (Var_Table*) malloc ( sizeof(Var_Table) );
for(int i=0; i< SIZE;i++){
(*table)[i] = NULL;
}
}
However, at the end of this code, it doesnt seems that the Init_ID_Table() had any affect on the * List_of_Variables pointer (which should now point onto a table of size SIZE and have all its elements set to NULL). Can anyone at least tell me what is going on if not how to change it to work as expected?
Thank you very much, Adam