-->

Sunday, March 1, 2015

Advantages and Disadvantages of pointers in C language

Advantages and Disadvantages of pointers in C language

By this time, you might have understood the concepts of  C pointers and if any problem is given, you should be in a position to solve. After understanding the full concepts of pointers, we should be in a position to answer the question " What are the advantages and disadvantages of pointers?"

Advantages

  1. More than one value can be returned using pointer concept (pass by reference).
  2. Very compact code can be written using pointers.
  3. Data accessing is much faster when compared to arrays.
  4. Using pointers, we can access byte or word locations and the CPU register directly. The pointers in C are mainly useful in processing of non-primitive data structures such as arrays, linked list etc.


Disadvantages

  1. Un-initialized pointers or pointers containing invalid addresses can cause system crash.
  2. They are likely to be used incorrectly causing bugs that are very difficult to identify and rectify.
  3. They are confusing and difficult to understand in the beginning and if they are misused the result is unpredictable.

Read other related articles

Also read other articles

© Copyright 2013 Computer Programming | All Right Reserved