Pointers

What is the best and most efficient way to learn pointers?

Watching videos?
Looking at good examples?
Or reading from a textbook?
probably reading something online is sufficient. A good way to learn them is hands-on, which I would do by writing the classic data structures (linked list, tree) by hand.

have you learned arrays?
pointers are like the index in an array. The index tells you where the data is, but by itself, is a meaningless number. Pointers are exactly the same, except the 'array' is your computer's memory. Because its the computer's memory, you have to ask the operating system for permission to use (and lock) a section of it, and return it when finished. This is a little overly simplistic, but that's pointers in a nutshell.
Last edited on
In modern C++ you should avoid pointers as much as possible. Use std::string and std::vector instead. If you really really need pointers then learn to use smart pointers.

https://www.codeproject.com/Articles/541067/Cplusplus-Smart-Pointers
https://mbevin.wordpress.com/2012/11/18/smart-pointers/
The best way to learn any aspect of programming is to try it. Reading/watching will give you an appreciation, doing will give you an understanding.

I suggest a good starting point would be to create a linked list class that can insert/remove/sort/search.

after that i'd try implementing a tree.

Jonnin and Thomas have some excellent advice of course (as always) but I strongly suspect they learned pointers the same way I did way back when they were pretty much the only gig in town.

Their advice is good sound advice, but following it will mean you will never learn how to use pointers safely and effectively, nor will you experience the joy and rage of pointer debugging that leads experienced devs to tell beginners to avoid pointers :)
Hello
1.Pointer is a variable which stores the address of another variable of same data type
2.For declaring a Pointer we use int*ptr
3. Pointer provides flexibility and more power.
https://www.certvalue.com/iso-9001-certification-in-iraq/
https://www.certvalue.com/iso-9001-certification-in-kuwait/
Topic archived. No new replies allowed.