0

Why pointers are used in c?

8th Jan 2020, 3:53 PM
pranav joshi
pranav joshi - avatar
5 Antworten
+ 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.
9th Jan 2020, 11:38 AM
Utkarsha Khanal
Utkarsha Khanal - avatar
+ 9
All languages use pointers. C just lets you touch them.
8th Jan 2020, 9:05 PM
John Wells
John Wells - avatar
+ 6
To reference to some other variable's location.
8th Jan 2020, 3:54 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 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.
8th Jan 2020, 4:08 PM
Arsenic
Arsenic - avatar
+ 3
Kindly go through this once again, and see what you don't understand. https://www.sololearn.com/learn/C/2933/
8th Jan 2020, 3:56 PM
Avinesh
Avinesh - avatar