3 ms·
Unfortunately, `int a[static 3][static 4]` does not work.
by Jasper_ 4y ago
Unfortunately, `int a[static 3][static 4]` does not work.
- klodolph 4y agoThat’s because you’d write it as: int a[static 3][4] You only need to put static on the outermost type, the one that decays into a pointer. Same thing applies if you need restrict: int a[static restrict 3][4] which is ugly but gets the job done. Think of int a[3][4], when used as a function parameter, as “pointer to int[4]” (the 3 disappears completely), and think of int a[static 3][4] as “pointer to first of at least 3 int[4]”. (Not trying to defend C here, just explaining how C works.)