Array of pointers in C++.
        Posted  
        
            by 
                Theorem
            
        on Programmers
        
        See other posts from Programmers
        
            or by Theorem
        
        
        
        Published on 2014-06-11T15:32:02Z
        Indexed on 
            2014/06/11
            15:39 UTC
        
        
        Read the original article
        Hit count: 189
        
c++
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.
© Programmers or respective owner