typedef of array of typedefs of array
It's bool[4][2]
You can verify it by static_assert:
static_assert(std::is_same<decltype(what_am_i), bool[4][2]>::value, "");static_assert(std::is_same<decltype(what_am_i), bool[2][4]>::value, ""); // failed
foo
is an array with 2
elements of type bool
, i.e. bool[2]
.
bar
is an array with 4
elements of type foo
, i.e. foo[4]
, each element is a bool[2]
.
Then what_am_i
is bool[4][2]
.
In order to complete @Slardar Zhang's C++ answer for C:
It's bool[4][2]
.
You can verify it by either one of the following:
sizeof(what_am_i)/sizeof(*what_am_i) == 4
sizeof(*what_am_i)/sizeof(**what_am_i) == 2