#include <iostream>
using namespace std;

int main() {
	int a=11; 
	int *pa=&a; 
	int *root = new int{2703};     
	
	const int* const *ptr;  // I want a pointer to a pointer that tshall not change 
	
	ptr = &root;            // I can now access root poitner via *ptr and integer via **ptr bu I'm not allowed to change them 
    //*ptr = &a;            // not allowed, I would change root !! 
    //**ptr=12;             // not allowed either  
    cout << **ptr<<endl; 	// no pb: I print the integer
    cout << *ptr<<endl; 	// no pb: I print 
    ptr = &pa;              // the pointer itself is not const 
    cout << **ptr<<endl; 	// no pb: I print the integer
    
    const int b=0;          // I'm not allowed to change b
    const int *pb=&b;       // I'm allowed to change pb but not *pb
    const int * const cpb = &b;   // I'm not allowed to change cpb nor *cpb
    ptr = &cpb;             // that's ok !  because ptr encforces everything that cpb enforces.  
    
    
    const int** test;       // this is a pointer to a pointer to a const int:  
    //test = &cpb;          // not allowed because because constness would be broken 
    test = &pb; 			// allowed
    *test = nullptr; 		// but also allowed: the pointer pb is now null 
    
	return 0;
}