A non-null single-object parameter
void func(double a[static 1]); Here, array syntax documents that a must point to at least one double. The static 1 notation distinguishes this contract from a parameter that may receive a null pointer. section 15.0
TAKEAWAY: A static array parameter uses array-parameter syntax to state a minimum number of pointed-to elements. The bound may describe one object or a known collection. section 15.0
Choose the declaration according to the pointer contract:
- Use static 1 for a pointer to one object that must be non-null: void func(double a[static 1]); section 15.0
- Use static N for a pointer to at least N elements: void func(double a[static 7]); section 15.0
- Use a VLA parameter when the element count is supplied separately: void func(size_t n, double a[n]); section 15.0
- Use pointer syntax when null is permitted: void func(double *a); section 15.0
void func(double a[static 1]); !@%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\":25}]]"} !@%STYLE%@!
Inspect the complete static 1 declaration and its highlighted syntax. section 15.0
