Skip to content

Instantly share code, notes, and snippets.

@mumreg
Last active August 19, 2016 12:23
Show Gist options
  • Save mumreg/d3760c9782fdb019b95de3dbf2cd579f to your computer and use it in GitHub Desktop.
Save mumreg/d3760c9782fdb019b95de3dbf2cd579f to your computer and use it in GitHub Desktop.
Fun with pointers #2
#include <iostream>
int main(int argc, const char * argv[]) {
int *a = nullptr;
int b = 10;
auto foo = [&b](int *&a) { a = &b; };
foo(a);
std::cout << *a << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment