declaring defines.
D'Arcy J.M. Cain
darcy at druid.uucp
Sun Jun 16 23:54:46 AEST 1991
In article <SVEN.91Jun15175330 at laverne.cs.widener.edu> Sven Heinicke writes:
>This does not work, is there any way to get something like this to compile?
>#define TRY {"look","at","this",NULL},{"and","this","too",NULL}
> char *first[][] = {TRY};
You need to tell it the size of the elements of 'first.' try:
char *first[][4] = {TRY};
The error message from your compiler should have told you that. Here is
what GNU C had to tell me:
t.c: In function main:
t.c:5: warning: array type has incomplete element type
t.c:5: elements of array `first' have incomplete type
t.c:5: array size missing in `first'
t.c:5: storage size of `first' isn't known
t.c:7: `first' undeclared (first use this function)
t.c:7: (Each undeclared identifier is reported only once
t.c:7: for each function it appears in.)
t.c:5: warning: unused variable `first'
make: *** [t] Error 1
Borland was a little less gabby but it told me that the size of array
first was unknown. Even Microsoft had something to say, "first: no
subscript' and cc on Unix said that line 5 had a null dimension. I
am curious as to what compiler you are using and what sort of error
message it gave you.
--
D'Arcy J.M. Cain (darcy at druid) |
D'Arcy Cain Consulting | There's no government
Toronto, Ontario, Canada | like no government!
+1 416 424 2871 |
More information about the Comp.lang.c
mailing list