Array intialization

Doug Gwyn gwyn at smoke.BRL.MIL
Mon Jun 5 21:28:13 AEST 1989


In article <3420 at ihuxv.ATT.COM> bareta at ihuxv.ATT.COM (Benyukhis) writes:
>The following declaration is illegal.  Why??????
>char *a = "string1";
>char *b = "string2";
>char *c = "string3";
>char *g[] = { a, b, c };

If the declaration has file scope, so that the variable `g' has static
storage duration, then the problem is that initializers must be constants,
not contents of variables.  If the declaration has block scope, then the
problem is that run-time initialization of auto aggregates isn't supported
by your compiler.



More information about the Comp.lang.c mailing list