written 2.2 years ago by |
Pointer :- A pointer is a variable that stores the address of another variable. Unlike other variables that helds values of a certain type, pointer holds the address of a variables .
Advantages of Pointers are :-
Pointer provide direct access to the memory.
Pointer provide a way to returns more than one value to the functions.
Pointers provides an alternate way to access array elements.
Pointers reduces the storage space and complexity of the program.
Pointer reduces the execution of the program.
Disadvantages of Pointers are :-
Pointer are slower than normal variables.
Uninitialized pointer might cause segmentation fault.
Dynamically allocated block needs to be freed explicity. Otherwise, it would lead to memory task.
If pointer bugs are updated with incorrect values, it migh lead to memory corruption.
Basically, pointer bugs are difficult to handle. So, use pointer effectively and correctly.
By using * operator we can access the value of a variable through a pointer.