#include <stdio.h>
int main()
{
int y, *py;
py=&y;
printf("%x",py);
}
----------------
Running it reveals the address of y, or at least the 32 least
significant bits.
Running it reveals the address of y, or at least the 32 least
significant bits.
albert@spenarnc.xs4all.nl writes:
Running it reveals the address of y, or at least the 32 least
significant bits.
Being able to find the addresses of memory objects is considered a
feature in C and it's used all the time in idiomatic C. In retrospect,
other languages have usually-good ways to do without that feature, such
as references, access types, etc. I think if you are writing an OS or >standalone embedded program in Ada though, it's not unusual to have some
low level parts of it in assembly language, that reach into the access
types and do stuff with the addresses.
All non-toy languages have side-effects. All i/o are side effects.
It is impossible to do that with addresses (ports or memory) that have connection to the real world, like actuators that close valves.
Relying on an OS only serves to hide this.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 916 |
Nodes: | 10 (1 / 9) |
Uptime: | 49:58:33 |
Calls: | 12,172 |
Calls today: | 2 |
Files: | 186,522 |
Messages: | 2,234,694 |