This is really simple code that prints the address of a variable :
int main()
{
int x;
scanf("%d", &x );
printf("Address of x : %X, value : %d" );
return 0;
}
<< moderator edit: added [co[u][/u]de][/co[u][/u]de]
tags >>
Simple as that.
But the thing is this program gives the same output for the address no matter when I run it - before system startup, or even with my RAM full with apps. Even if I run multiple instances of the program, the address remains the same, leading me to believe that many different values are stored at the same address.
Can somebody please explain why this happens? Is it that the variable isn't really stored in the RAM at all?