I have a function that is passed 6 variables and I want to write some code to figure out which one has the lowest value. This is what I have so far:
Code:
int LeastInStore(int pup, int kitn, int bird, int snk, int fish, int bun)
{
int lowest = 0;
int i;
int quantityOfPets[7];
char petType[20];
int lowestpet =0;
for(i=0; i<7; i++) quantityOfPets[i]=NULL; //initializing the array to NULL
quantityOfPets[1] = pup;
quantityOfPets[2] = kitn;
quantityOfPets[3] = bird;
quantityOfPets[4] = snk;
quantityOfPets[5] = fish;
quantityOfPets[6] = bun;
for(i = 1; i<6; i++){
if(quantityOfPets[i] < quantityOfPets[i+1])
if(lowest > quantityOfPets[i]){
lowest = quantityOfPets[i];
}
}
return lowest;
}


