dynamic array of strings
Michael P.
baseball.mjp at gmail.com
Mon Dec 29 19:36:24 PST 2008
import std.stdio;
import std.cstream;
void main()
{
char[][] names;
char[] currentName;
while( true )
{
din.readf( "%s", ¤tName );
if( currentName == "stop" )
{
break;
}
else
{
//what goes here to dynamically allocate memory for the
//names array? new statement? .length?
}
}
foreach( name; names )
{
writefln( name );
}
}
How would I go about dynamically allocating memory for the names array in the part that I commented?
I'm not really sure about the dynamic array details in D, this is just an example to help.
-Michael P.
More information about the Digitalmars-d-learn
mailing list