0
char array[2] = {'1', 0 };
std::cout << array;

Why does it output the contents and not the memory adress, aren't arrays pointers ?

Aplet123
  • 33,825
  • 1
  • 29
  • 55
Blopper
  • 3
  • 2
  • 1
    Yes, arrays are pointers. It output the contents of the array because that's what the `<<` overload for character pointers does. – Sam Varshavchik Aug 02 '20 at 19:10
  • 3
    @SamVarshavchik Arrays are not pointers. But there are many cases (like passing to a function) where an array will *decay* into a pointer to the first element. – Kevin Aug 02 '20 at 19:12

0 Answers0