Interviews Questions, Algorithms, Aptitude, C Interview Program, C Theory Question, Aptitude Tricks, Test Series,

Showing posts with label Usage of the pointer in C. Show all posts
Showing posts with label Usage of the pointer in C. Show all posts

Saturday, 1 June 2019

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.