Ok, ok, I'm an idiot :)
I copied the second one wrong. Mine has [] but the compiler still has
trouble reading it. It gives me the following warnings in the following struct:
desc.c:26: warning: braces around scalar initializer for `ab_desc[0]'
desc.c:26: warning: initialization makes pointer from integer without a cast
desc.c:26: warning: excess elements in scalar initializer after `ab_desc[0]'
desc.c:27: warning: braces around scalar initializer for `ab_desc[1]'
desc.c:27: warning: initialization makes pointer from integer without a cast
desc.c:27: warning: excess elements in scalar initializer after `ab_desc[1]'
struct abil_desc {
int rnum;
char *e_desc;
};
struct abil_desc *ab_desc[] = {
{10002, abil_desc_parse[0]},
{-1, "\0"}
};
Whenever the mud calls for ab_desc[0].e_desc the mud crashes. Anyone know why?
Thanks for any help.
Chuck
>
>The crucial difference is not inside the curly brackets, its that
>char *abil_desc_parse is not the smae as char *abil_desc_parse[].
>In C, an array is the same as a pointer, so that
>char *abil_desc_parse[] == char **abil_desc_parse
>that is char *abil_desc_parse is a string, but
>char *abil_desc_parse[] is a pointer to an array of strings, which is
>what you want.
>
>HTH
>
> -Hans
>
>
> +------------------------------------------------------------+
> | Ensure that you have read the CircleMUD Mailing List FAQ: |
> | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
> +------------------------------------------------------------+
>
>
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST