What is the usage of the pointer in C?
- Accessing array elements: Pointers are used in traversing through an array of integers and strings. The string is an array of characters which is terminated by a null character ‘\0’.
- Dynamic memory allocation: Pointers are used in allocation and deallocation of memory during the execution of a program.
- Call by Reference: The pointers are used to pass a reference of a variable to other function.
- Data Structures like a tree, graph, linked list, etc.: The pointers are used to construct different data structures like tree, graph, linked list, etc.