What are the pointers used for? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What are the pointers used for?

10th Jun 2017, 3:12 PM
Erik Tini
Erik Tini - avatar
3 Answers
+ 11
If you are asking about what pointers can do that normal variables can't, you may want to look into the implementation of advanced data structures such as linked lists, binary trees, etc. http://www.cprogramming.com/tutorial/lesson18.html
10th Jun 2017, 3:34 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
for assigning values to a variable, for makinh reference of global variables, for pointing address of a variable, for point a variable pointing a variable pointing to an address of a variable.
10th Jun 2017, 3:24 PM
Rinmawia
Rinmawia - avatar
+ 1
Pointers stores variable address in memory. This gives you the possibility for example of passing arguments to functions by reference, (avoiding multiple copies of by objects ) manage memory in the heap, ...
10th Jun 2017, 3:17 PM
Ulisses Cruz
Ulisses Cruz - avatar