If i initialized a pointer in a code, it has a memory address and a value,
Lets say the pointer's name is Pointer
NOW : What is the difference between when we cout Pointer and when we cout &Pointerr ???
As they give me 2 different memories..
N.B(If we cout *Ptr it will just cout it's values, like if *Ptr = 3, it will show 3)
Copy and paste the code below and u will understand me, cout *pointer gives 5.99, pointer and &x gives same memory address BUT &pointer gives a different one, That's my question: WHY DIFFERET MEMORY ADDRESS??
Code:
#include <iostream>
using namespace std;
double *temp;
void SevenPointThree(double *temp)
{
*temp=7.3;
}
int main()
{
double x=5.99;
double *pointer = &x;
cout<<*pointer<<endl;
cout<<pointer<<endl;
cout<<&x<<endl;
cout<<&pointer<<endl;
cin.get();
return 0;
}