The correct answer is: "it depends."
(printf should use the "% p" directive and direct the address to "void *" to clearly define:
printf("%p\n", (void *)&a);
although using% u will no doubt work for your specific compiler with any flags you use.)
As @Alex noted, the address is virtual if translation occurs (both in most modern OSs and when working in an "emulated physical" under a virtual machine). The address itself is usually determined at link or load time if "a" has a static storage duration, but at runtime (on the stack as @Als said) if not. Variables declared as โstaticโ or โexternalโ have a static duration; variables declared outside functional bodies have a static duration; and variables declared in function bodies, but without the use of "extern" or "static", have automatic storage duration (and, thus, are usually in the "stack", although there may be several stacks, as when using POSIX streams).
torek source share