#include <iostream>
using namespace std;

int main() {
	int* ptr = new int(2);
	int& i = *ptr;
	std::cout<<i<<std::endl; //prints 2
	ptr = new int(3); //now ptr points to another address
	std::cout<<*ptr<<std::endl; //prints 3
	std::cout<<i<<std::endl; //still prints 2!
    return 0;
}