difference between * and & in c++

#include <iostream>

using namespace std;

int main() {

    int val = 5;

    int& rref = val;

    int* ptr = &val;


    cout<<"in main"          << endl

        << "val   =  "   << val   << endl

        << "&val  =  "   << &val  << endl

        << "rref  =  "   << rref  << endl

        << "&rref =  "   << &rref << endl

        << "ptr   =  "   << ptr   << endl

        << "*ptr  =  "   << *ptr  << endl

        << "&ptr  =  "   << &ptr  << endl;


in the aspect of the appearance of code and undrestanding the code via the way it looks like for human/abstract(somehow)

this example shows that in c++ mentionning the name of rref in a function such as ccout is equvalent/printing the original value (val==rref)

and mentionning &rref is equvalent to address of original  ((&val) or (&val==&rref))


mentioning the name of ptr is equvalent to address of original  ((&val) or (&val==ptr))

and mentioning *ptr is equvalent to the original value (val==*ptr)

however there is one more : that is &ptr that is not equvalent to any of those in the above. 

by some thinking even without reading from books and writtens we can come this point that : probably that is because pointer variable itself has an extra allocation compare to refrence therfore in another language pointer is a rference to refernce (somehow even if not exactly)

terminologies might not be enough accurate and precise ... please try to rethink it.


    return 0;