Why are `&array` and `array` pointing to the same address?

Until now, I thought an array is the same as a pointer. But I found a weird case:

code

int array[5] = { 10,11,12,13,14};

std::cout << array << std::endl;
std::cout << &array << std::endl;
std::cout << &array[0] << std::endl;

int *pArray = new int[5];

std::cout << pArray << std::endl;
std::cout << &pArray << std::endl;
std::cout << &pArray[0] << std::endl;

output

0x7ffeed730ad0
0x7ffeed730ad0
0x7ffeed730ad0

0x7f906d400340
0x7ffeed730a30
0x7f906d400340

As you can see array and &array have the same value. But pArray and &pArray have different value. If array is same as pointer, address of array should be different from array. How can arrayand &array be the same? If array and &array are same, what is the address of the memory which holds the array values?

#c++ #arrays

4.65 GEEK