#include <iostream>
using namespace std;

int main() {
    int **r = new int *; // declare pointer to int*
    cout << r << endl;   // outputs some address in memory (pointer to int*)
    cout << *r << endl;  // outputs some garbage value
//  cout << **r << endl; // it's invalid
    
    *r = new int;        // assign to memory pointed by r new value
    cout << *r << endl;  // outputs some address in memory (pointer to int)
    cout << **r << endl; // outputs some garbage value
    
    delete *r;           // delete pointer to int
    cout << *r << endl;  // outputs same address in memory, but we can't dereference it
//  cout << **r << endl; // it's invalid, because we deleted *r
    
    // here you can acces r, *r, but not 
    return 0;
}