+ 2

Does anyone have any practical uses for pointers?

I've been experiementing with pointers. I've used memory management, polymorphism, function pointers etc. I'm starting to understand it, but what can I actually use it for? Is it possible to do this in the playground?

28th Jun 2020, 9:25 AM
Clueless Coder
Clueless Coder - avatar
3 Respostas
+ 2
There are many mannny uses of pointers. This one is super dooper booper simple use.Kind of useless but a convinience. https://code.sololearn.com/cVtcF5KDEcfG/?ref=app Suppose the name of the array was like list_of_expotential_numbers then every time you have to use a value you have to write that awfully big name everytime instead you can just use a pointer pointing towards it to use it instead of the giant name. Another example is my code.(Not self-promting here just showing where it works) https://code.sololearn.com/c7Rj8Z0Pma4F/?ref=app In line 138 , instead of write array name everytime for each argument of a function, I used a simple pointer to name all the elements of the array. There you go , one somewhat of a use of pointers. Have a good day, Ćheyat
28th Jun 2020, 12:06 PM
Saphal Poudyal
Saphal Poudyal - avatar
+ 6
Try coding a simple game with a GUI, it'll help you understand the importance of Abstraction.
28th Jun 2020, 9:46 AM
Gordon
Gordon - avatar