Return an owned filtered array through output parameters

Write int positives(const int *src, size_t n, int **out, size_t *count). The caller supplies live out and count objects and n valid source ints (src may be NULL only for n = 0). Count values > 0, allocate exactly that many ints and preserve their order. Return 1 on success, including an empty result represented by *out = NULL and *count = 0. On allocation/size failure return 0 with both outputs reset to that same empty state. The output must own an independent copy; src is borrowed and unchanged. Explain why int ** is needed here. Driver: n in 0..12, then n representable ints; print count=k followed by retained values.


