I am confused about the following two cases, why would one works, the other one doesn't work. 

The one works:

```
int* test()
{
    int j=5;
    int *i = &j;
    return i;
}

```

the one doesn't work:

```
int* test()
{
    int j=5;
    return &j;
}

```

Both of them return a local pointer, isn't it?

Can anyone explain me the reason behind? Thanks.