It is not obvious that an uninitialised builtin type is initially assigned zero. Nor is it always true. It just happens to be zero when you ran the app. Try compiling for release and see what happens.
a is a variable like any other. It has an address so you can do &a. As it's a pointer, you can do *a. The results are not deterministic in any event. This is because *a is an uninitialised value and &a is determined by the runtime environment.
@Bhavesh205
i try it on release and find that 'cout<<a' is not changing while using 'cout<<&a'.
Could you explain why do you think that a shall be changed after the statement 'cout<<&a;'?
It seems that you understood nothing what you were sayed avout. Please reread our previous messages.
Each variable (so also any pointer type) has an address and a value. The address can be retrieved by putting '&' before it's name, the value by the name of the variable itself:
1 2 3 4 5 6 7 8 9 10 11 12
int a = 5;
std::cout << a; // prints the value in a, which is 5
std::cout << &a; // prints the memory address of a, which differs per run of the program
int* p;
std::cout << p; // prints the value in p: some garbage, differs per run
std::cout << &p; // prints the memory address of p (remember, a pointer is just a normal variable, and therefore it has a place in memory)
p = &a; // store the address of a in p
std::cout << p; // prints the value of p, which is now the address of a
std::cout << &p; // logically prints the address of p again
std::cout << *p; // the '*' operator can only be used with pointers: here it prints the value that is on the memory address that p stores: that memory address is the address of a, so it prints the value of a: 5