Why is the address of an array the same the array converted to a pointer?

When t is used on its own in the expression, an array-to-pointer conversion takes place, this produces a pointer to the first element of the array.

When t is used as the argument of the & operator, no such conversion takes place. The & then explicitly takes the address of t (the array). &t is a pointer to the array as a whole.

The first element of the array is at the same position in memory as the start of the whole array, and so these two pointers have the same value.

Leave a Comment