Array of pointers in C++.
- by Theorem
I am not understanding the output of this ,
#include <iostream>
using namespace std;
// pointers and arrays
char ch1 = 'a' , ch2= 'b';
char ch3[6] = {'c', 'd', 'e', 'f', 'g' , 'h'};
char *ptr[3];
int main ()
{
ptr[0] = &ch1 ;
ptr[2] = ch3;
cout << &ch1 << endl;
}
The out put is abcdefgh .
isn't &ch1 supposed to give the address of ch1 ? I cannot make sense why the output should be abcdefgh.