www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to initializing an array of strings?

reply Bill Baxter <dnewsgroup billbaxter.com> writes:
How does one do this?

   char[][] words = ["a", "list", "of", "some", "words"];

--bb
Oct 30 2006
parent reply Johan Granberg <lijat.meREM OVE.gmail.com> writes:
Bill Baxter wrote:

 How does one do this?
 
    char[][] words = ["a", "list", "of", "some", "words"];
 
 --bb
I don't have a compiler here but have you tried this. char[][] words = ["a"[], "list", "of", "some", "words"][];
Oct 30 2006
parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Johan Granberg wrote:
 Bill Baxter wrote:
 
 How does one do this?

    char[][] words = ["a", "list", "of", "some", "words"];

 --bb
I don't have a compiler here but have you tried this. char[][] words = ["a"[], "list", "of", "some", "words"][];
Thanks! That does it (without the trailing []) char[][] words = ["a"[], "list", "of", "some", "words"]; --bb
Oct 30 2006