Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some thoughts:

>> A pointer is a variable that holds, literally points to, a memory address

What is a memory address?

How does a pointer literally point to a memory address?



C assumes some sort of object space addressable to the byte (each object is composed of one or more bytes -- no such a thing as a 0 bytes object in C). It's the memory pretty much. Afaik, what is an address is not defined as part of the language. I guess people should use the knowledge they got from their "how computers work" classes =D. A pointer holds an address. I think that's as deep as you can get with this as clarifying goes.

You can though, say, to help learners that the address of an object is a value which can be used to indirectly access the object. You could say that it's a value that you can keep with you, to access the object later, indirectly.

And, as any language that I am aware of. Things are usually defined abstractly (in terms of what you want to be true about them). C is not different. You won't find concrete definitions (things may look concretely defined, but they're not). As far as we're concerned, addresses are these things that

- the address-of operator returns

- is help by pointers

- can be indirected

- ...

It could be represented as a character string for all we know.


It's the guide to pointers, not the guide to memory addresses—I think readers are expected to google unfamiliar terms.


I think if I understand memory addresses and assembly language, then I understand pointers. If the guide doesn't explain why pointers are useful and efficient on real hardware, then it's missing the point. Which was my point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: