Mail Archives: djgpp/2000/05/04/05:45:55
On Thu, 4 May 2000, nimrod a. abing wrote:
> I think it's because the compiler seems to confuse
> between `char **string_array' and
> `char *string_array[]'. The former is a pointer to
> pointer to char types. The latter is an array of char
> pointers.
The compiler is not confused: these *are* two different things, as others
have explained to you. It was a bug in your code.
> If the compiler compiles this without issuing
> some sort of warning, then one would assume the code is
> correct when in fact they refer to two distinct types.
Welcome to C. The C programming language traditionally assumes that the
programmer knows what she is doing. You should turn on all of the
warning options ("-Wall -W" would be a good start) if you want better
diagnostics, but even then I'm not sure the compiler would flag this
particular bug, because some valid programs use it (and know how not to
crash ;-).
- Raw text -