void func(double a[static 7]); Here, static 7 promises that a is a pointer to at least seven double elements. The declaration describes an interface requirement, not an array stored inside the parameter. section 15.0
TAKEAWAY: Use static N when a function expects a non-null pointer to a collection containing at least N elements. A static 1 parameter expresses the corresponding promise for a single object. section 15.0
Choose the parameter form that matches the permitted argument:
- double a[static 1] — pointer to one object; the argument must be non-null. section 15.0
- double a[static 7] — pointer to a collection with at least seven elements. section 15.0
- double a[n] — pointer to a collection whose required count is supplied by n. section 15.0
- double *a — permits a single object or a null pointer, provided execution remains defined for null. section 15.0
void func(double a[static 7]); !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":4}],[{\"line\":0,\"ch\":10},{\"line\":0,\"ch\":16}],[{\"line\":0,\"ch\":19},{\"line\":0,\"ch\":27}]]"} !@%STYLE%@!
Compare the complete static-bound declaration directly with the promised minimum of seven elements. section 15.0
