Address-of operator (&) accepts a lvalue and returns a pointer object whose value is the address of that lvalue.
We can use address-of operator as shown below:
int value{100};
std::cout << &value;So, &value returns pointer object int* and printing &value prints the address of value variable.
If we check the type of &value, we should see something like below:
#include <iostream>
#include <typeinfo>
int main(int argc, char const *argv[])
{
int value{100};
std::cout << &value << "\n";
std::cout << typeid(value).name() << "\n";
std::cout << typeid(&value).name() << "\n";
return 0;
}0x30a284aec
i
Pi
where i is int type for variable value and Pi is Pointer to int.