c - C程序中变量的地址

标签 c

#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/

相关文章:

c - 关于pthread_join函数的问题

c - 如何处理计算器溢出?

c - 没有if语句的输出

c - makefile编译多个目标

c++ - 使用 gdb 将数组内容打印到文件

c - 用于支持和不支持 VARIADIC 的编译器的 printf 宏

c# - float* 从 C 到 C#

c - 段错误 11 : C with MPI

代码段作为宏参数

c - 理解 C 中的函数指针