Skip to main content

Posts

Showing posts from November, 2023

Introduction to Pointers in C

  Introduction to  Pointers Introduction: In C programming, a pointer is a special variable that stores the memory address of another variable. Pointers are powerful tools that allow direct manipulation of memory and enable dynamic memory allocation. They play a crucial role in tasks such as dynamic memory allocation, accessing hardware, implementing data structures, and optimizing code performance. In simple terms pointers are the variables which store addresses of another variable. It can also store addresses of functions, arrays, structures and other pointers along with primitive data type variables. But the question arises “ why do we need pointers? “. Let’s find out the answer for the above question. Declaration of pointers Declaration of pointer variables is almost same as declaring normal variable, only difference is that we add ‘ * (asterisk) ‘ sign before the pointer variable. Syntax data_type *pointer_variable_name; E.g. int *num;  // pointer variable which can...