If we define an array/struct like this:
int a[5] = { 1, 2, 3, };
struct b { int c; int d; } e = { 1, };
or even:
int a[5] = { 1, 2, 3 };
struct b { int c; int d; } e = { 1 };
we get no error from C compiler as the missing elements are initialized with a 0 default, like when we write explicitly:
int a[5] = { 1, 2, 3, 0, 0 };
struct b { int c; int d; } e = { 1, 0 };
Is there a way to disable the default initialization of an array in C, so that the compiler gives an error or warning when the elements are not all defined?
I am using gcc 4.8.0 (MinGW).