Consider the following code
struct dummy1 {
int b;
dummy1();
};
struct dummy {
dummy1 a[];
int c;
dummy();
};
int main()
{
dummy foo;
foo.a[0].b = 5;
foo.a[1].b = 6;
return 0;
}
dummy::dummy()
:a()
,c()
{
}
dummy1::dummy1()
: b()
{
}
I am getting an error "Incomplete type is not allowed" , As far as i know we get this error if the structure we are defining the object of is not defined or the header file is not included which is not the case strangely when I define my int c
before a[]
the code works so replacing this
struct dummy {
int c;
dummy1 a[];
dummy();
};
the code works just fine, Any ideas why this might be happening ?
P.S I am using VS2015