Initialisation of Character Arrays

Doug Gwyn gwyn at smoke.brl.mil
Fri Nov 16 06:11:01 AEST 1990


In article <12585 at ganymede.inmos.co.uk> bj at inmos.co.uk (John Honniball) writes:
-static          char s1[] = "String One";
-static unsigned char s2[] = "String Two";
-static signed   char s3[] = "String Three";
-gcc -c -ansi -pedantic u.c
-u.c:2: warning: ANSI C forbids string initializer except for `char' elements
-u.c:3: warning: ANSI C forbids string initializer except for `char' elements

Compiler error.  3.5.7, as you pointed out, says that an array of
character type may be initialized by a character string literal.
"Character type" is formally defined in 3.1.2.5.



More information about the Comp.std.c mailing list