summaryrefslogtreecommitdiffstats
path: root/examples/15_borrow-error.cpp
blob: 74213cee1b8ab628e84bddce4add9855b133e087 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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;
}