struct A
{
int arr[];
};
int main()
{
A a[5];
std::cout << sizeof(a) << std::endl;
return 0;
}
$ g++ -std=c++14 test1.cpp -o test1 && ./test1
0
Притом:
struct A
{
int arr[];
};
int main()
{
struct A a[5];
printf("%d", sizeof(a));
return 0;
}
$ gcc -std=c99 test.c -o test1
test.c:7:5: error: flexible array member in otherwise empty struct
int arr[];
^