Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lakesys!chad From: chad@lakesys.UUCP (Chad Gibbons) Newsgroups: comp.lang.c Subject: vector initialization Keywords: vectors, char** Message-ID: <687@lakesys.UUCP> Date: 6 Jun 89 13:54:17 GMT References: <2730@oregon.uoregon.edu> <18226@unix.cis.pittsburgh.edu> Reply-To: chad@lakesys.UUCP (Chad Gibbons) Distribution: usa Organization: Lake Systems - Milwaukee, Wisconsin Lines: 34 ...at the risk of being burned at the stake; After scanning a few books, I've been unable to find an answer either way to my question, so I must resort to the help of the net. Question: is it possible to initialize a vector? I tried using the same syntax as an array of pointers, i.e. char *foo[] = { "one", "two", "three", NULL }; but this would not compile. Since I am initializing it, it would seem an array of pointers would suffice. However, in the context of something along these lines (from a command list vector): typedef struct _com { char **words; int (*fcn)(); short flags; } COM; ...and then initializing the structure in another module by: COM foo[] = { { "one", "two", "three", NULL }, do_num, 0, { "exit", "quit", NULL }, quit, 0 }; That would be nice, but something tells me it isn't C, or anything else like it. I may resort to allowing only a single word per structure, but it would be more advantageous to use a list associated with a single structure entry. Anyway to achive this? Perhaps the actual structure definition is the problem here, I'm not sure. -- D. Chadwick Gibbons, chad@lakesys.lakesys.com, ...!uunet!marque!lakesys!chad