I am not clear for how long a variable is guaranteed to be allocated in C.

For example, if I have:

```
void foo(void) {
  int x;
  int* y = &x;
  ...
}

```

Is the space allocated on the stack for `x` guaranteed to be reserved for this variable exclusively for the entire duration of `foo()`? Said differently, is `y` guaranteed to point to a location that will be preserved for the entire duration of `foo`, or could the compiler decide that since `x` isn't being used, the stack space can be used for another use within `foo` and therefore `*y` may change without accessing `y` (or `x`) directly?