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



Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
candide said:
I try to find out what exactly means "an array and
its address are the same"

They aren't. An array is an array. An address is a
pointer value. These are not the same thing. If you
mean that &array and &array[0] are the same,
they aren't. They have different types.

or "have the same value".

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]?

Everybody seems to agree that they doesn't share
the same type, of course.

And therefore they cannot have the same value.

So 1 is _not_ the same value as 1u?

Can you then tell me what the standard means when
it says...

"The range of nonnegative values of a signed
integer type is a subrange of the corresponding
unsigned integer type, and the representation
of the same value in each type is the same."
^^^^^^^^^^

Either 'same value' is independant of type, or
above line makes no sense. Which is it?

--
Peter
.



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: strcpy - my implementation
    ... Since you're initialising an array of integers, ... If the type were non-integer (e.g. pointer, or floating point, or struct ... integer type can safely be initialized with memset, ...
    (comp.lang.c)
  • Re: determining alignment of objects
    ... They actually have an array a of objects of size es and what they do ... They don't convert directly to an integer type because at the time ... there was no obvious type to use and the conversion of a pointer ... but C implementations are not malicious in practise. ...
    (comp.lang.c)
  • 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: multi dimensional arrays as one dimension array
    ... please - where does the standard say that such a conversion ... Pointer conversion yields a pointer to the same object as ... exist only where there are array declarations. ...
    (comp.lang.c)