New course! Every coder should learn Generative AI!
Try a free lesson+ 4
When you pass an argument to a function, that value has to be copied, and that costs time and memory when the object is large.
A pointer stores the memory address of a value.
So a function taking a pointer parameter is virtually saying:
'Look, that data I need, that's a lot of paper; please don't copy it all, just give me the link and I read the information from there directly.'
+ 4
With pointers you can do alot of memory optimization
+ 3
Pointers are very useful while doing memory locations related operations. If you have to pass a complete array at one go.. you can use pointers.