Take this C code for example
#include <stdio.h>
#include <stdlib.h>
int main() {
int x;
int* y = (int *) malloc(10*sizeof(int));
printf("%p\n",&x);
printf("%p\n",y);
printf("%p\n",&(y[1]));
while(1);
return 0;
}
What will print virtual addresses that look something like this.
0x7ffd4e96d214
0x908010
0x908014
Will the virtual addresses be different each time the binary file starts, which made me think, how is the virtual address actually determined for the program?
source
share