Comment

Comment by MaulingMonkey

Quite right.

A set of interesting equalities:

    (void*)&array   == (void*)&array[0]   // likely true
    (void*)&pointer == (void*)&pointer[0] // likely false (although it could be true by coincidence)
A pointer to an array is the address of the first element.

The name of an array can be trivially and implicitly converted to the address to it's first element, but this conversion creates a (temporary) pointer, it does not make the array itself a pointer!

The array (nor it name) is not in and of itself storage for any such address, it is no pointer, and as a result &array won't give you back a pointer-to-pointer because there's no underlying 4-8 byte storage for the underlying pointer - there's no permanent pointer to point to.

parent MaulingMonkey 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton