+ 1

I can't understand the use of pointers..... What is their use

2nd Dec 2016, 12:43 PM
Dhairya Jain
Dhairya Jain - avatar
3 Answers
+ 5
a variable that holds address of another variable in it is called pointer. Now why it is used It mainly used in data structure. New programmers think how to code. But a program will effective work and say a good program if it has less time complexity and efficient data uses. Pointer holds variable address so, if you want to change data in variable, changing in pointer will effect the variable also. Also sending data to function and function use a call by value it need more data. it will create a another variable of that size which take more memory block in ram. But if you use pointer it will take only address and that size is much less than an another variable of that type. Pointer is much faster than variables.
2nd Dec 2016, 1:07 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 2
Pointers are used for dynamic data structures (linked lists, binary trees, hash tables 
). In many situations you will not know (at compile time) what type and quantity of data a program will require at run time. When the program requests memory and creates instances it will receive a pointer to the memory or object. Also many objects from standard (GUI) libraries can only be created at run time and must be accessed via pointers.
2nd Dec 2016, 1:12 PM
Gordon Garmaise
Gordon Garmaise - avatar
0
pointer plays important role in data manipulation in functions.
2nd Dec 2016, 1:09 PM
Bibek Ghimire
Bibek Ghimire - avatar