Newsgroups: comp.lang.c
Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!lethe!druid!darcy
From: darcy@druid.uucp (D'Arcy J.M. Cain)
Subject: Re: declaring defines.
Message-ID: <1991Jun16.135446.988@druid.uucp>
Organization: D'Arcy Cain Consulting, West Hill, Ontario
References: <SVEN.91Jun15175330@laverne.cs.widener.edu>
Date: Sun, 16 Jun 91 13:54:46 GMT

In article <SVEN.91Jun15175330@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@druid)     |
D'Arcy Cain Consulting             |   There's no government
Toronto, Ontario, Canada           |   like no government!
+1 416 424 2871                    |
