As I understand, when function is called from translation unit and this function uses global variable of this translation unit, variable address is unchangable. In case of recalling function from this module address does not change. How can I provide, every entering into module's function will update variable address? Is it real to allocate variable at the stack, not at the data segment?
For example, we have module MODULE and function FUNC of this module. Also we have MODULE2 and FUNC2 of this module. Variable VAR is global variable of MODULE.
- Call FUNC of MODULE
- Call FUNC2 of MODULE2
- Call FUNC of MODULE. How can I provide to reallocate VARIABLE location in every entering into MODULE (actually every FUNC calling)?
&to pass a pointer to the variable.