1. ## Trouble with function

Heres what needs to be accomplished:
"Write a function to print the day of the week and number of the week on which the minimum power output occurred. If there are several days with the minimum power output, print the information for each day."
Heres what I have
Code:
```/*----------------------------------------
This function finds minimum output of array and prints
out the day and week #*/
void min(int power[NROWS][NCOLS])
{
/*Declare and intialize variables*/
int i, j;
double min_x;

/*Determine minimum value in the array.*/
min_x=power[NROWS][NCOLS];
for(i=1; i<NROWS; i++)
{
for(j=1; j<NCOLS; j++)
if(power[i][j] > min_x)
min_x = power[i][j];
printf("Minimum Power Output \n Outage: %f \n Week: %d \n Day: %d \n",min_x, i+1, j+1);
}
}```
Just looking at my code and not worrying about what exactly is in my array, will the right things be printed out and if not how do I fix it. Thanks

2. It would print something out every time through a row. It would claim that it was always the last day of the week, even if it wasn't.

"Print every time this minimum occurs" == "You will need a separate for loop to print the minimum, in case there's more than one."

Edit: Also, you fail to consider the first row or first column of the array.

3. ??? the conditions im my for loop should be how exactly, maybe like this
[code]for(min_x = 0; min_x = power[NROWS][NCOLS]; min_x++)

4. That makes even less sense. But you do need i and j to start at 0, otherwise you will fail to consider the first row or first column of the array.

Also I forgot to mention that power[NROWS][NCOLS] fails to exist, so your attempt to set min_x to that number at the start is doomed.

5. ok so intialize i and j to 0 got it, but even tho im passing that array down from my main function it still doesnt exist, how or why?

6. The array exists. The array element power[NROWS][NCOLS] does not.

7. oh so when i first declare that my min_x = power[NROWS][NCOLS] they should be replaced with 0 so maybe it should look like this at first
Code:
`min_x=power[0][0];`

8. Right.

9. ok so now all that crap is fixed i need to put my printf statement in a loop? what if i just put my print stament under my second for loop what exactly would that outcome be?

10. Under the second for loop means it would only print one time, regardless of how many times it needs to print. Also the values for i and j would be meaningless.

11. ok so it needs to be outside both loops and needs to have its own loop is that what you said earlier?

12. Right.

13. yea still no clue on what the conditions should be in my for loop? sorry

14. Why would they be different from before? You still need to go through the entire array.

15. well i dont see how this would be any different from what i had if i did this
Code:
```for(i=1; i<NROWS; i++)
for(j=1; j<NCOLS; j++)
printf("Minimum Power Output \n Outage: &#37;f \n Week: %d \n Day: %d \n",min_x, i+1, j+1);```
i mean does this work or is this even what your talking about