typedef struct Individual{
int number_of_la;
double cost;
}Individual;
void deleteIndividual2(Individual **ind){
if((*ind)==NULL) return;
freeLists2(&((*ind)->MSC),1);
freeLists2(&((*ind)->BSC),1);
freeLists2(&((*ind)->LA),1);
freeLists2(&((*ind)->BS),1);
(*ind)->MSC=NULL;
(*ind)->BSC=NULL;
(*ind)->LA=NULL;
(*ind)->BS=NULL;
free((*ind));
(*ind)=NULL;
}
//LAList-LA-LA_BS ,if includeGroup=1 remove all LAList-LA-LA_BS otherwise List and element will be removed
void freeLists(Network_Element_List *head,int includeGroup){
Network_Element_List *temp=head;
while(temp !=NULL ){
Network_Element_List *x=temp->next;
if(includeGroup) freeLists(temp->element->groupHead,0);
if(includeGroup) free(temp->element);
free(temp);
temp=x;
}
}
Here are my basic functions above, what i want to do is above first one doesnt work
second one works without any memory error
///11111111111111111111111111111111111111111111(Problem)
Individual **temp_;
temp_=(Individual **)malloc(sizeof(Individual)*5);
temp_[0]=applyMutation(current)
temp_[1]=applyMutation(current)
temp_[2]=applyMutation(current)
temp_[3]=applyMutation(current)
temp_[4]=applyMutation(current)
deleteIndividual2(&temp_[0]);
deleteIndividual2(&temp_[1]);
deleteIndividual2(&temp_[2]);
deleteIndividual2(&temp_[3]);
deleteIndividual2(&temp_[4]);
//2222222222222222222222222222222222(working one)
Individual *temp0=NULL,*temp1=NULL,*temp2=NULL,*temp3=NULL,*temp4=NULL;
temp0=applyMutation(current)
temp1=applyMutation(current)
temp2=applyMutation(current)
temp3=applyMutation(current)
temp4=applyMutation(current)
deleteIndividual2(&temp0);
deleteIndividual2(&temp1);
deleteIndividual2(&temp2);
deleteIndividual2(&temp3);
deleteIndividual2(&temp4);