Pointer Operator in C Programming Language

Notes:

Dereferencing (or Pointer or indirection) operator (*): in C programming language
- is used to create a variable; which holds the address of another memory location
- a variable which holds the address of another memory location is called a pointer variable or pointer
- is also called as an indirection operator

Note: Pointer operator
- is used to create a pointer to a variable, a constant or some memory location
- is also used to get or set the value at a pointer is pointing

Syntax:
data_type *variableName;
Ex:
int *ptr=NULL; // ptr is a pointer to an integer type variable

Example Code:
#include <stdio.h>
int main()
{
int a = 0;
int *ptr = NULL;

printf("Value of a= %d\n",a);// Value of a= 0
printf("Address of a= %d\n",&a);// Address of a= 2293528
printf("\n");

ptr = &a;
printf("Value of ptr= %d\n",ptr);// Value of ptr= 2293528
printf("Value at ptr is pointing= %d\n",*ptr);// Value at ptr is pointing= 0
printf("\n");

*ptr = 10;
printf("Value at ptr is pointing= %d\n",*ptr);// Value at ptr is pointing= 10
printf("Value of a= %d\n",a);// Value of a= 10
printf("\n");

a = 20;
printf("Value of a= %d\n",a);// Value of a= 10
printf("Value at ptr is pointing= %d\n",*ptr);// Value at ptr is pointing= 20

return 0;
}