Last active
August 19, 2016 12:23
-
-
Save mumreg/d3760c9782fdb019b95de3dbf2cd579f to your computer and use it in GitHub Desktop.
Fun with pointers #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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