Skip to content

Instantly share code, notes, and snippets.

@fabiogaluppo
Created January 25, 2016 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiogaluppo/659b242782b83ae85726 to your computer and use it in GitHub Desktop.
Save fabiogaluppo/659b242782b83ae85726 to your computer and use it in GitHub Desktop.
int z = 4;
int& w = z;
auto w1 = z; //int
std::cout << z << " " << w << " " << w1 << "\n"; //4 4 4
w = 16;
std::cout << z << " " << w << " " << w1 << "\n"; //16 16 4
w1 = 256;
std::cout << z << " " << w << " " << w1 << "\n"; //16 16 256
auto& w2 = z; //int&
w2 = 65536;
std::cout << z << " " << w << " " << w2 << "\n"; //65536 65536 65536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment