Re: Keil c51 interprets &Array as Array. Is that normal?



Tim Wescott wrote:

Yes it is a pointer to an array of 10 chars. No it is not a pointer to char. There _is_ a difference, but the compiler is well aware of it and will seamlessly cast from pointer-to-array-of-N-char to pointer-to-char.

Erm, no. Not really.

Pointers to incompatible types are themselves incompatible with each other, so there's no implicit conversion (what you call "seamlessly casting").
.



Relevant Pages

  • Re: working with addresses
    ... pointers in argument lists. ... up to him and now they're trying to make it back into a 64-bit compiler. ... % cat alpha.c ... char **beta; ...
    (alt.comp.lang.learn.c-cpp)
  • Re: arithmetic on a void * pointer
    ... In the good old days, any self-respecting C compiler knew what you meant when you did arithmetic on a void * pointer, i.e. that the units were bytes. ... So now you can't do arithmetic on void * pointers. ... which says exactly what you mean: "convert buf to a (char *), ...
    (comp.lang.c)
  • Re: Aliasing bug when casting char[] into char* ?
    ... char* a potential source of aliasing bug? ... The problem is that on Visual C++ 2003, the two returned pointers are ... It looks like the compiler is at fault (or else I've ...
    (comp.lang.c)
  • Re: folder parsing (newbie)problem
    ... this is an array of char*. ... If so you are using a weird compiler. ... you should probably read up on pointers and on malloc. ...
    (comp.lang.c)
  • Re: Warning meaning.
    ... int main(int argc, char *argv) ... an array of pointers and that each ... This is what your compiler is ...
    (comp.lang.c)