Pointers add a level of indirection.
"Any problem in computing can be solved by adding another level of indirection." - David Wheeler
So, essentially, pointers can solve any problem in computing.
Name:
Anonymous2012-03-22 23:45
But why do I need ```pointers'''? Superior programming languages like Java don't have them.
Does your computer have memory?
Does that memory have addressing?
If you'd like to put something in that memory, at an address, or read something out of that memory, at an address, then you're going to need a pointer.
Or, you could stick with Java and pretend that your computer doesn't really have memory or addresses and that a magical fairy will always make sure your data goes where it's supposed to go and that the magical garbage fairy will always come along and clean up the stuff that you're done with and thaKILL YOURSELF
Pointers are awesome and you do need them. Let me tell you some of the cool shit you can do with pointers:
* Completely dynamic code-base -- use pointers for all your functions and arbitrarily set them at run-time to point to new functions. This allows for a kind of plugin system.
* Accessing other "variables" directly from functions.
* Pointing to shit on the heap. If you want to return certain objects from a function and they are stack based then when the function returns you lose your reference as the stack is gone. So you alloc shit off the heap and return a pointer to it.
* Binary dick trees.
* Hand coded optimization when a compiler wouldn't be clever enough to implement it itself (the optimization cannot feasibly be proven correct).
Name:
Anonymous2012-03-23 15:49
Making hardware architecture transparent to the programmer is actually pretty nifty. It's just the way C handles the grammar to use it that's retarded.
Name:
Anonymous2012-03-23 16:02
Interesting, all the points in >>8-13 are valid. I didn't realize there were actual programmers here.
Pointers are just the most efficient and least safe way of manipulating data. If you need your hand held, then pointers aren't for you.
Name:
Anonymous2012-03-23 16:58
Thank you very much for your answers.
Actually, I have another question regarding ``pointers´´: