Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!uwvax!oddjob!mimsy!chris From: chris@mimsy.UUCP Newsgroups: comp.lang.c Subject: Re: char *** initialization and compiler problem Message-ID: <5791@mimsy.UUCP> Date: Fri, 13-Mar-87 16:40:47 EST Article-I.D.: mimsy.5791 Posted: Fri Mar 13 16:40:47 1987 Date-Received: Sat, 14-Mar-87 09:44:10 EST References: <1721@plus5.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 50 In article <1721@plus5.UUCP> hokey@plus5.UUCP (Hokey) writes: >First, I have been *unable* to initialize the master table in any way other >than that in the example below. I tried *lots* of combinations of braces. I am not quite sure what you want, but the example is correct. >Second, the *only* declaration acceptable to the compiler for the given >initialization of the table is the one below. Not surprising: it is the correct one. condensed: >extern char *sys_errlist[]; /* as per perror(3C) */ >char *a_list[] = { ... }; >char *b_list[] = { ... }; The types of `sys_errlist', `a_list', and `b_list' are each `array of pointer to char' ( varies, being `unknown', 7, and 5, I think, though I have deleted the actual initialisations). When used in ordinary expression contexts, the types are converted to `pointer to pointer to char'. Thus: >char **em_t[] = { > sys_errlist, > a_list, /* Just try and initialize with strings here! */ > b_list, > 0 >}; `em_t' is `array 4 of pointer to pointer to char'. Given the comment after `a_list', I guess that you might want, e.g., something more like this: char **em_t[] = { sys_errlist, /* * magic unnamed list: (char *[] = { "a0", "a1", "a2", ..., 0 }), * and another, `b', list. */ 0 }; Alas, there is no C construct that creates an unnamed block of initialised data space (an object of type `array of ') save for anonymous arrays of char, which are created with "string". -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: seismo!mimsy!chris ARPA/CSNet: chris@mimsy.umd.edu