Why do pointers behave differently when they are pointing to an integer array and a character array?
For example
int num[] = {1,2,3};
cout << num ;
This prints out the ADDRESS of the first element
char list[] = { '1', '2', '3'};
cout << list ;
This prints out the VALUE of entire elements of array!
Likewise
cout << (num+1) ;
prints out the ADDRESS of the second element. While
cout << (list+1);
prints out the VALUE of entire array beginning from the second element
From my understanding, array name is a pointer to the first element of the array. Without the dereference operator(*), the pointer should return the address of the element. But why is the char pointer returning the value?
operator<<is an overloaded function, and there is a different overload forchar *than for other pointer types