1.

What is the use of the pointer in C?

Answer»

The FOLLOWING are some of the important uses of pointers in C:

  • To access array elements: Pointers are USED in traversing through an array of integers and strings. The STRING is an array of characters that is terminated by a null character '\0'.
  • For dynamic memory allocation: Pointers are used in the allocation and deallocation of memory while the program is being executed.
  • Call by Reference: The pointers are used to pass the reference of a VARIABLE to another function.
  • Data Structures like a graph, tree, linked list, etc.: The pointers are used to CONSTRUCT a number of data structures like graph, tree, linked list, and so on.


Discussion

No Comment Found