No dynamic Arrays in Struct?

torhu fake at address.dude
Sat Feb 10 00:14:45 PST 2007


Manfred Nowak wrote:
> void main(){
>   struct S{
>     int[] map;
>     map.length= 1000; // error: no identifier for declarator map.length
>   } S s;
> }

You can't have an assignment in the struct definition.  Try just using 
'int[1000] map;' instead.  Or set the size in a function, if you want to 
have a dynamic array with preset length.


More information about the Digitalmars-d-learn mailing list