Re: [CODE] [OT] Multi-dimensional Arrays of Strings

From: Chris Gilbert (chris@buzzbee.freeserve.co.uk)
Date: 03/19/00


Deja Augustine wrote:
>
> Okay, here's another question that I can't find any help for (AND YES I DID
> HUNT THE ARCHIVES)
>
> I pride myself as a pretty good coder, but this one problem is bugging me
> (and I haven't been able to find help for it anywhere else).
>
> What's the syntax to declare and initialize a multi-dimensional array of
> strings?
>
> Here's the code I started out using:
>
> const char *CLASS_SPELL[][NUM_CLASSES + 2] = {
> { "YES", "NO", "NO", "NO", "spell1", "1" },
> { "NO", "YES", "NO", "NO", "spell2", "5" }
> };
>
> That doesn't seem to be working quite right, so I was curious if anyone could
> tell me how I could properly accomplish this task...

Looks right, check out do_gen_tog for an example that uses const char
*tog_messages[][2].  That might help you, other examples make a struct
of char *'s and then have an array of them, eg the interpreter table
(although that includes int's as well)

Chris


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT