Join Regular Classroom : Visit ClassroomTech

Advantages of using pointer in C

The Pointer in C, is a variable that can store address of another variable of same datatype. The pointer is used to save memory space and get faster execution time.

How pointer works?

Pointers are considered as the most useful tools in computer program for the following reasons:

1. Using a pointer makes a program very simple and it also reduces the length of the program.

2. The execution speed of the program increases when pointer is used.

3. In case of traversing through array and strings (strings are also arrays of characters terminated by ‘\0’ (NULL) character).

4. Pointers are used in dynamic memory allocation because during the execution of a program pointers are helpful in allocation and deallocation of memory.

5. Storage of strings through pointers save memory space.

6. In arrays, strings, variables and functions pointers are used as arguments of a function.

7. Passing on arrays by pointers saves a lot of memory space. Instead of passing all the elements of the array we are passing only the addresses of the elements.

8. Pointers are also can be used in linked lists, queue, stacks etc.


You Missed

Also Checkout