0

Heya,

When I run this code, it spits out the minimum value 200, when I want it to spit out the minimum value from the function.

Any pointers?

```
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
// You can assume no inputs will exceed these values:
#define MAX_BOXES 50
#define MAX_PARCELS 50
int UnassignedMinimum(int allocation[], int value[], int numItems, int min[], int minimum);
int main(void)
{
int numBoxes, numItems, minimum;
int allocation[10] = {1, 0, 0, 0, 4, 5, 6, 7, 8, 9};
int value[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int min[10];
int i, sum;
minimum = 200;
numItems = 6;
UnassignedMinimum(allocation, value, numItems, min, minimum);
printf("%d", minimum);
return;
}
int UnassignedMinimum(int allocation[], int value[], int numItems, int min[], int minimum)
{
int i, sum;
sum = 0;
//This function sums the unassigned minimum and checks if it is the smallest value. If it is it stores it in the min array.
for(i = 0; i < numItems; i++){
if(allocation[i] == 0){
sum = sum + value[i];
}
}
if(minimum > sum){
minimum = sum;
for(i = 0; i < numItems; i++){
min[i] = allocation[i];
}
}
return minimum;
}
```