Re: [cc65] OT: Question about Power C and C128

From: Karri Kaksonen <karri1sipo.fi>
Date: 2005-07-05 07:18:47
Payton Byrd wrote:

>I know this is off topic, but I figured it's the most
>likely place for someone to have run across my
>scenario.
>
>I am writing a game in Power C for the 128.  I'm
>having a problem enumerating a two dimensional char*
>array declared like this:
>
>char* _sVerbs =
>{
>    { "n", "N", "orth" },
>    { "s", "S", "outh" },
> /** etc. **/
>};
>
>No matter what I do, I can only get the first row of
>data which always returns back "n", "N", and "orth". 
>I've tried directly indexing the array like this:
>
>_sVerbs[i][0] where i is the row I want.
>
>I've tried indexing the pointer:
>
>*(_sVerbs + (i * sizeof(char*))[0]
>
>I've tried getting a pointer to the inner array:
>
>char** sLine = _sVerbs[i];
>s = sLine[0];
>
>No matter what I do I always get back the first row of
>the array regardless of the value of i.
>
>Is this a known problem with Power C that I should
>avoid, or am I just being completely stupid?
>
>  
>
I can not answer the last question, but I believe C arrays should work
like this:

char *_sVerbs[][3] =
{
    { "n", "N", "orth" },
    { "s", "S", "outh" },
    etc...
};
th = _sVerbs[i][0];

--
Cheers,

Karri

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Jul 5 06:45:42 2005

This archive was generated by hypermail 2.1.8 : 2005-07-05 06:45:44 CEST