I came across this code on reddit. I would have thought that type conversions would have caused this to be invalid.
int a[3] = { { {1, 2}, {3, 4}, 5, 6 }, {7
int a[3] = { { {1, 2}, {3, 4}, 5, 6 }, {7, 8}, {9}, 10 };
is invalid.
It is invalid for the same reasons int b[1] = {1, 2};
is invalid: because C99 says
(C99, 6.7.8p1) "No initializer shall attempt to provide a value for an object not contained within the entity being initialized."
The last element 10
in a
initializers attempts to provide a value for an object not contained within the entity being initialized.