Re: Address of an array = address of its 1st element: undecidable question ?



Richard Heathfield wrote:
CBFalconer said:
Peter Nilsson wrote:
Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:

... snip ...

If you try to take the value of an array, what you
actually get is the value of a pointer to the first
member of the array. That doesn't mean that an array
is the same as a pointer. If you mean that &array
and &array[0] have the same value, they don't. They
have different types.

What about (void *) &array == (void *) &array[0]?

You should get "syntax error" or equivalent.

Why?

Woops - I read that as '=', not as '=='. Good catch.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


** Posted from http://www.teranews.com **
.



Relevant Pages

  • Re: char **argv & char *argv[]
    ... "pointer to pointer to char". ... >> pointer)) pointing to the first element of an array. ... so we have to start adding more context. ... type "pointer to char", rather than "array MISSING_SIZE of char". ...
    (comp.lang.c)
  • Re: track positions in arrays= index variables || pointers to elements?
    ... > and it holds an address of a member of the buffer. ... > It's type is unrelated to the type of the array. ...
    (comp.lang.c)
  • Re: Question about arrays in objects
    ... >>I want to create a 2d array as an object member. ... > handled in the constructor, you just can't use a plain old array. ... > that is where using a pointer would come in. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: why cannot assign to function call
    ... hypothetical C-like languages, ... sizeof business would still indicate that a pointer was being passed. ... talk about variables of an array type. ... the earlier version of the standard didn't have numbered ...
    (comp.lang.python)
  • Re: Youre appointed as Portability Advisor
    ... None of its behaviour is undefined by the Standard. ... to write to member A of a union and then read from member B, ... character type that treats the thing as an array of bytes. ... dereferencing a pointer to one ...
    (comp.lang.c)