I'm trying something like this
void receiver (char* x)
{
cout<<x<<endl; //prints "a"
cout<<*x<<endl; //prints "a"
cout<<&x<<endl; //prints address of x
}
int main()
{
char p = 'a';
cout<<p<<endl; //prints "a"
cout<<&p<<endl; //prints "a"
receiver(&p);
}
In the main function for both p and &p, it is printing the value of p.
If it is int instead of char, then p would print the value and &p would print the address. Why is this strange behavior with char?