My guess is. However all the example I see create an instance of item_type say item_type_instance. However my case is more simpler...I want something descriptive for my array not just using 0 and 1.
enum item_type {weight, cost};
and then substitute weight and cost for 0 and 1.
void algo(int cost_low,int cost_high,int throw_weight, int item_id)
{
int quantity,remainder;
quantity=throw_weight/item_matrix[item_id][0];
remainder=throw_weight%item_matrix[item_id][0];
if(remainder==0)
{
cost_low=(quantity-1)*item_matrix[item_id][1];
cost_high=quantity*item_matrix[item_id][1];
throw_weight-=(quantity-1)*item_matrix[item_id][0];
}
else
{
cost_low=quantity*item_matrix[item_id][1];
cost_high=(quantity+1)*item_matrix[item_id][1];
throw_weight-=quantity*item_matrix[item_id][0];
}
}