Min / Max function of 1D array in C / C++
It's not quite the best.  There's some things IMHO that is hindering its performance and usefulness.

There's no point in declaring val as a static variable.  In fact, you've killed any chance of it being usable in multi-threaded programs.

The body of the loop is performing an assignment in every single iteration when it doesn't need to.  If you want it to be its best, you should only be doing so when it is required.

Your overall structure is fine, assuming we can expect well-formed inputs where array is nonempty and size is positive, I'd just change it so it's more like this:

double min(const double *arr, size_t length) {
    // returns the minimum value of array
    size_t i;
    double minimum = arr[0];
    for (i = 1; i &lt; length; ++i) {
        if (minimum &gt; arr[i]) {
            minimum = arr[i];
        }
    }
    return minimum;
}