Skip to content

Instantly share code, notes, and snippets.

@simplay
Created January 22, 2016 15:01
Show Gist options
  • Save simplay/a6fd3f7b627e155225bc to your computer and use it in GitHub Desktop.
Save simplay/a6fd3f7b627e155225bc to your computer and use it in GitHub Desktop.
Pointers are evil...
#include <iostream>
using namespace std;
int main() {
int i = 10;
int j = i;
int &ai = i;
int *pi = &i;
*pi = *pi + 1;
std::cout << ai+j << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment