#include <stdio.h>
main()
{
int i = 5;
printf("%d \n" , &i);
}
重复执行上述程序是否会导致变量i
的地址不同?
最佳答案
是的,可以。这是来自类似问题的解释:
It signifies that your program is being loaded a different (virtual) address each time you run it. This is a feature called Address Space Layout Randomization (ASLR) and is a feature of most modern operating systems.
来自这里:Why address of a variable change after each execution in C?
关于c - C程序中变量的地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25071995/