
Address: 2686778
Note: You may obtain different value of address while using this code.
In above source code, value 5 is stored in the memory location 2686778. var is just the name given to that location.
You, have already used reference operator in C program while using scanf() function.
scanf("%d",&var);
Reference operator(*) and Pointer variables
Pointers variables are used for taking addresses as values, i.e., a variable that holds address value is called a pointer variable or simply a pointer.
Declaration of Pointer
Dereference operator(*) are used to identify an operator as a pointer.
data_type * pointer_variable_name;
int *p;
Above statement defines, p as pointer variable of type int.
Example To Demonstrate Working of Pointers
/* Source code to demonstrate, handling of pointers in C program */
#include <stdio.h>
int main(){
int *pc,c;
c=22;
printf("Address of c:%d\n",&c);
printf("Value of c:%d\n\n",c);
pc=&c;
printf("Address of pointer pc:%d\n",pc);
printf("Content of pointer pc:%d\n\n",*pc);
c=11;
printf("Address of pointer pc:%d\n",pc);
printf("Content of pointer pc:%d\n\n",*pc);
*pc=2;
printf("Address of c:%d\n",&c);
printf("Value of c:%d\n\n",c);
return 0;
}