0
Why pointers are used in c?
5 Respuestas
+ 2
The main advantage of pointers is that, when passing a object as parameter to the function. Call by value is very expensive for large objects as the function creates new object in its local stack and then copies the content of the passed object to its local temporary object this effects the run time performance of the program. If we pass object's pointer as arguments then we can directly work with that object without creation and copying. Think about passing gta5 character mesh object using pass by value to function. How much time will it take to copy? Pointers are also heavily used in low level programming, eg in embedded system we have to know I/O device memory and so on.
+ 9
All languages use pointers. C just lets you touch them.
+ 6
To reference to some other variable's location.
+ 4
Job of pointer is just to hold address of some other variable in C
It have a great use in data structures as most of the data structures use pointers.
+ 3
Kindly go through this once again, and see what you don't understand.
https://www.sololearn.com/learn/C/2933/