| delorie.com/archives/browse.cgi | search |
| From: | dontmailme AT iname DOT com (Steamer) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: gdb problem or just silly me - please help |
| Date: | Wed, 03 May 2000 09:23:11 GMT |
| Organization: | always disorganized |
| Lines: | 25 |
| Message-ID: | <390fefef.8895067@news.freeserve.net> |
| References: | <KDINAGPDJPIJCAAA AT shared1-mail DOT whowhere DOT com> |
| NNTP-Posting-Host: | modem-205.blue-spotted-stingray.dialup.pol.co.uk |
| X-Trace: | newsg4.svr.pol.co.uk 957345792 29883 62.136.238.205 (3 May 2000 09:23:12 GMT) |
| NNTP-Posting-Date: | 3 May 2000 09:23:12 GMT |
| X-Complaints-To: | abuse AT theplanet DOT net |
| X-Newsreader: | Forte Free Agent 1.11/32.235 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
nimrod a. abing wrote:
>char *a_string_array[] = {
> "Now is the time for all good men",
> "To destroy the earth",
> "And have beer parties across the galaxy.",
> ""
>};
[snip]
>extern char **a_string_array;
[snip]
>Now in most C books,
>they say `char **string_array' is equivalent to
>`char *string_array[]'.
I hope not.
>Now why does it crash?
Because you've told the compiler that a_string_array is a pointer
to a pointer to char, when in fact it's an array of pointers to
char. So when you refer to a_string_array[0] the code will try
to interpret the four bytes "Now " as a pointer.
S.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |