I have some problems with this code. I am trying to change the values of the selectedArrays below by calling this function. But it doesn't work. Can anyone see why?
I know that the Stores,Suppliers and Plants Arrays are containing values, but I cannot get the selectedArrays to point at them.
Code:
void createSelectedArrays(int* binaryDecisionArray,int** selectedStores,int** selectedPlants,int** selectedSuppliers,Environment* e){
int *Stores,*Plants,*Suppliers;
/*
Here I fill the Stores, Suppliers and the Plants array with values. Then I want the selectedArrays to contain the values of Stores,Suppliers and Plants. But it want work .. :(
*/
//I fill them like this
for(i=suppliersMin; i<suppliersMax;i++){
if(binaryDecisionArray[i]==1){
Suppliers[supplierLocation]=i;
supplierLocation++;
}
}
selectedSuppliers = &Suppliers;
selectedPlants = &Plants;
selectedStores = &Stores;
}
This is how I call the function in an other function.
Code:
int *selectedStores,*selectedPlants,*selectedSuppliers;
createSelectedArrays(binaryDecisionArray,&selectedStores,&selectedPlants,&selectedSuppliers,e);