BETA Try the new lesson view
Code

Sorting

Let's sort the temperatures and find the median, the middle value.

sort_array

void sort_array(int t[], int n)

It is the selection sort from the theory: the outer loop i runs from 0 to n - 2, the inner j looks for the smallest among t[i]..t[n - 1], then a swap through temp. The function changes the array, so the parameter has no const.

A copy

find has to return the day in the original order. If we sorted temperatures itself, day 3 would no longer hold the temperature measured on day 3. So we sort a copy (sorted, "sorted"):

int sorted[DAYS];
for (int i = 0; i < DAYS; i++) {
    sorted[i] = temperatures[i];
}
sort_array(sorted, DAYS);

sorted = temperatures; wouldn't compile: an array is copied only box by box.

The median is the middle box of the sorted array: sorted[DAYS / 2], that is [3], the fourth of seven.

Run it

...
Warmest: day 4, 8 C
Sorted: -2 -1 3 4 5 6 8
Median: 4 C
Which temperature to look for? 5
5 C was first on day 3.

The search still says "day 3": the original array didn't change.

Commit: Sort temperatures.