this behaviour does not comply with my understanding of "process address space".
take the following c code:
compile and run it a few times.
across different runs, i would expect global_var and stack_var to have the same addresses.
global_var actually does.
stack_var does not.
on gnu/linux, the address of stack_var changes at every run.
can someone please explain me why?
what is it that makes gnu/linux behave the way it does?
cheers
take the following c code:
Code:
#include <stdio.h>
int global_var;
int main() {
int stack_var;
printf("address of global var...%p\n", &global_var);
printf("address of stack var....%p\n", &stack_var);
}
across different runs, i would expect global_var and stack_var to have the same addresses.
global_var actually does.
stack_var does not.
on gnu/linux, the address of stack_var changes at every run.
can someone please explain me why?
what is it that makes gnu/linux behave the way it does?
cheers





Comment