Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!rutgers!mcnc!unccvax!cs00jec From: cs00jec@unccvax.uncc.edu (Jim Cain) Newsgroups: comp.lang.c++ Subject: initializing a struct (or any class) array Keywords: struct initialization Message-ID: <2840@unccvax.uncc.edu> Date: 14 Oct 90 19:59:55 GMT Organization: University of NC at Charlotte Lines: 23 I am trying to define a structure array for a static set of data. In C I would declare the following: struct { char *name; int i; } list [] = { "namezero", 5, "nameone", 1, ... "namen", 16 }; This will be used by a parser as a look-up table for command names and other information which belongs to each command. This is identical to C code I have written that works. My question is -- Is something this simple possible in C++? It seems that C++ considers structs and unions as classes. Can you initialize class object arrays like this? I really don't want the overhead of using pointers (such as a linked list representation) because there is no reason for this data to be dynamic (unless, of course, that's the only way to do it).