Printing of character variable

I am trying to print address of a particular character variable , but the output is not satisfying.
int main()
{
char ch[]=“Abhishek”;
char c=‘A’;
char s=‘B’;
cout<<&s<<endl; // BAAbhishek is output
cout<<&c<<endl; // AAbhishek is output
cout<<&ch<<endl; // 0x6ffe00 is output
cout<<ch<<endl;
char *p = ch;
p+=4;
cout<<p<<endl;

}

In my view , the outputs in these cases should be

  1. B
  2. A
  3. Abhishek
    respectively

Since ch is an array, the string “Abhishek” will not be printed and the base address of the character array will be printed. The above cases are only for a single character…not for array.

Ok thanks.
Can you pls tell for the above two cases why BAAbhishek and AAbhishek are printed

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.