Array of pointers

I was under the impression that (p_arry) alone automatically refers to the first element of my array. It doesn't seem to be the case here because I am getting a different address aside from (&a). What is it pointing to?

The name of an array points to its first member (not is its first member). So &p_arry is the address of both the array itself and the address of its first member, &p_arry[0]. The actual element that is stored in that member is an address that points to a.

When I dereference (* p_arry) then I get the address of (&a), which really throws me off even more. What is going on when I dereference (* p_arry)?

There s no space reserved between the beginning address of an array and the address or it's first element (same with classes and structs if I'm not mistaken). So, the address of the array (which is the address of where it begins in memory) is the same as it's first element. Note though that there can be, and often is, space after each element for alignment.

/r/cpp_questions Thread