4 ms·
And why is this useful? Well, for high-level folks, pointers are used for roughly the same thing as reference variables in other languages. For low-level folks
by danjayh 11y ago
And why is this useful? Well, for high-level folks, pointers are used for roughly the same thing as reference variables in other languages.
For low-level folks, sometimes you need to be able to read from / write to a specific address in memory. So if you have, for instance, a system clock device that always give you the current time if you read address 0x1234, you might do something like this:
uint64 system_time;
uint64 system_time_device = 0x1234; // A pointer to the system time device...
system_time = system_time_device; // read the contents of the memory at address 0x1234 to get the time
- redler 11y agoFor anyone confused, HN's formatting system changed the two asterisks that give this meaning into italics-start and italics-end. unit64 system_time; unit64 *system_time_device = 0x1234; // set pointer system_time = *system_time_device; // read what's pointed to