declaring defines.

Dave Eisen dkeisen at leland.Stanford.EDU
Sun Jun 16 23:36:55 AEST 1991


In article <SVEN.91Jun15175330 at laverne.cs.widener.edu> sven at 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}
>main()
>{
>  char *first[][] = {TRY};

No, not really. You can only leave the first array index blank when 
making an incomplete array declaration. Even though it seems that
the compiler should be able to figure out that you want to declare
first to be char *first[2][4], the language doesn't allow you to
write char *first[][].

By the way, this has nothing to do with the preprocessor. You would
have the exact same problem if it were written:

   char *first[][] = {
      {"look", "at",    "this", NULL},
      {"and",  "this",  "too",  NULL}
   };



More information about the Comp.lang.c mailing list