Design a nullable result-parameter contract

Write int minimum(const int *a, size_t n, int *out). Return 1 and store the minimum for a valid nonempty array and nonnull out. Return 0 for n = 0, a = NULL or out = NULL, without modifying *out when it exists. Other nonnull pointers must designate valid objects; NULL checks cannot prove that arbitrary addresses are valid. Explain why returning the minimum directly is insufficient if every int can be an element. Demonstrate empty, duplicate-minimum and singleton cases.


