int main() {
char a[5];
a[0] = 0;
return a[0];
}
In this snippet, does char a[5];
, which is an array declaration without any initialization, guarantee allocation of 5 bytes of consecutive memory?
Or since only 1 element gets initialized later, compiler is free to use a register for that 1 element?
I'm assuming that reading any other index of this array beside 0
is undefined behaviour.