Code:
#include <stdio.h>
int main()
{
int i = 0;
int array[3][2][4] = {
{{ 1, 2, 3, 4}, { 5, 6, 7, 8}},
{{ 9, 10, 11, 12}, {13, 14, 15, 16}},
{{17, 18, 19, 20}, {21, 22, 23, 24}}
};
return 0;
}
Note that the definition for the array has changed - those commas shouldn't be in there!
I'm pretty sure that technically you don't need them, but should, and will get a warning without them:
Code:
a.c: In function ‘main’:
a.c:8:26: warning: missing braces around initializer [-Wmissing-braces]
8 | int array[3][2][4] = {
| ^
9 | 1, 2, 3, 4, 5, 6, 7, 8,
| {{ } { }}
10 | 9, 10, 11, 12, 13, 14, 15, 16,
| {{ } { }}
11 | 17, 18, 19, 20, 21, 22, 23, 24
| {{ } {
12 | };
| }}