Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!genrad!mit-eddi!mit-vax!eagle!harpo!floyd!vax135!ariel!houti!hogpc!houxm!whuxk!steve From: steve@whuxk.UUCP Newsgroups: net.lang.c Subject: Re: array and structure initialization Message-ID: <223@whuxk.UUCP> Date: Mon, 13-Jun-83 12:22:52 EDT Article-I.D.: whuxk.223 Posted: Mon Jun 13 12:22:52 1983 Date-Received: Tue, 14-Jun-83 09:17:56 EDT References: sri-unix.5611 Lines: 23 In reference to why the statements struct foo { char *f_slist[]; int f_code; } struct foo foobar = { {"xx", "yy", ""}, 1}; leads to compiler errors, the problem lies with the definition of the foo structure. The member f_slist cannot be declared as an array of character pointers in that fashion--it must be given a size. The only places that such a declaration is allowed (i.e. an array with no explicit dimensions) is 1. When declaring an array with a list of initializers (e.g. char *ptrs[] = { "abc", "def", "ghi" }; 2. When declaring an externally-referenced array. 3. When declaring a formal parameter array. If you try adding a dimension to f_slist, then you will find that your initialization will work correctly. Steve Kochan BTL Whippany