Uses and features of pointer in C programming Language.

In the given fig.
int a=10;
The integer variable a is declared and initialized to 10.
int *ptr=&a;
*ptr=20;

int *ptr=&a;
Here the address of variable a is assigned to ptr.
*ptr=20;
The value 20 is assigned to pointer variable *ptr.
the value of a becomes 20 .Because of the ptr is assigned address of variable a.The value 20 is actually stored at address of vriable a i.e 2000.
Let us study some of the uses and features of pointers in C Language.


Uses of Pointer in C

1. Pointers are used to pass arguments by reference
2. Pointers are used to return multiple values
3. Pointers are used to accessing array elements
4. Pointers are used to Manage memory dynamicaly.
used to dynamic memory allocation
5. Pointers are used to to implement complex data structures
6. Pointers are used to do develope system-level programming where memory addresses are useful.


Features of Pointers in C.

1.Memory Management:  Memory is accessed and managed efficiently with the pointers. The pointers dynamicaly assigns and releases the memory. Hence the pointers can be used to allocate memory dynamically.
2. Use of pointers save memory space.
3. The program execution time with pointers is faster because data manipulation are performed with the address, that is, pointers use direct access to memory location.
4. Pointer are used to perform file operations reading,writting modify etc.
5. Pointers are used to implements data structures. They are used to represents single or multidimensional arrays.
6. Pointers are used to access An array, of any type without use of its subscript range.
7. Pointers allocates memory dynamically.

Drawbacks of Pointers in C.

• Pointers read wrong value if pointers points to some incorect address or location.
• Erroneous input always leads to an erroneous output.
• if not pointers initialized the Segmentation fault can occurs..
• It requires one additional dereferences step.
• If programmer forgot to deallocate a memory then it will lead to a memory leak problem.


Previous Topic:-->> Syntax of Pointer initialization in C. || Next topic:-->>The Pointer to an array in C.