Analog to Digital converter module of MCU - Conceptual question
This question doesn't really have anything to do with the ADC specifically; what you're really asking about is the use of automatic variables inside C functions. The fact is that val and proxval don't even exist at the same time &mdash; each one only exists when its corresponding function is actually executing.

Automatic variables (variables declared inside a function and not declared as static) are allocated on the CPU stack (or a simulation of a stack if the CPU hardware doesn't support it).

It is possible that the same physical location on the stack is used for both variables, if the two functions are called from the same level in the calling hierarchy, and they have the same parameters.