My course ended and the next chapter was on pointers. I always get on this site and see pointers, pointers, and more pointers. I read the first little section, which was actually a bit. My book tells me what pointers are doing but never once say's why they are use full.
My question is why are pointers needed? What are they used for? For instance you use arrays to organize data. You use pointer to.........?

To point. :)

Jokes aside, they're used for a bunch of reasons. If you want a function to actually manipulate some object that resides in another function, you would just pass a pointer to the former function. If you have an object representing an image, you don't really wanna be copying that all the time, so you just throw around a pointer to it.

You'll quickly find if you do any amount of programming in C or C++ that you need pointers a lot. For a real world example, classes wouldn't be possible without pointers.
ok thx
Topic archived. No new replies allowed.