[A89] Re: c trouble
[Prev][Next][Index][Thread]
[A89] Re: c trouble
>because "foo" is a char[4], and "" is a char[1], but the compiler doesn't
>acknowledge that char[4] and char[1] are _functionally_ equivalent and so
>won't treat them as the same type. A little casting lets you fill char** 's
>at compile time but that involves too much typing for little 'ol me.
>
Heh looks like i jumped on the jibberish bandwagon too. Let me try to
explain why i never fill a char** at compiler time again.
The difference between
char * strings[]={...}
and
char ** strings ...
is that declaring a char** doesn't allocate contingous memory. Thus, "char
** strings={...}" doesn't work. "char *strings[]" does allocate memory, and
the "={...}" fills it. Forgive my earlier nonsince.
I have known people who used pointers to 2d arrays (i.e. "(char*)
&strings", where strings is char [][]) quite a bit, but when the strings
have different lengths, it messes things up a bit.
_________________________________________________________________
Help protect your PC: Get a free online virus scan at McAfee.com.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963