diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-07-02 02:54:21 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-07-02 02:54:21 -0400 |
commit | e620daf3b1a40ae825c625bc4328fb7d2b3ee8b6 (patch) | |
tree | faa469408ee78623eaa8d2720dcbb36096788ca1 /examples/15_borrow-error.cpp | |
download | intro-to-rust-yapc-na-2014-e620daf3b1a40ae825c625bc4328fb7d2b3ee8b6.tar.gz intro-to-rust-yapc-na-2014-e620daf3b1a40ae825c625bc4328fb7d2b3ee8b6.zip |
Diffstat (limited to 'examples/15_borrow-error.cpp')
-rw-r--r-- | examples/15_borrow-error.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/15_borrow-error.cpp b/examples/15_borrow-error.cpp new file mode 100644 index 0000000..74213ce --- /dev/null +++ b/examples/15_borrow-error.cpp @@ -0,0 +1,14 @@ +#include <iostream> + +int *foo(void) +{ + int x = 2; + return &x; +} + +int main(int argc, char *argv[]) +{ + int *x = foo(); + std::cout << *x << std::endl; +} + |