Hi guys, hope everyone is doing well. I'm trying to practice with pointers a bit and tried to define what I thought was the same pointer in three different ways and got three different addresses. Anyone can explain to me what I'm doing wrong? Here is my code and the output i get
I understand that maybe I'm printing the address of the pointer variable but how do I print the actual pointer. And if I were to print the actual pointer am I right to believe that all definitions are equivalent?
Thanks a bunch,
Nick
cout << (int)cp; //this is the address of firstname[0]
cout << &cp; //this is not. This is the address of cp, which is not firstname, its the pointer's address