Concept

Let Computer Memory

+---+---+---+---+---+--
|   |   |   |   |   | ...
+---+---+---+---+---+--
100  101 102 103 104  ...
int x = 35, y = 46;
x   y 
+---+---+---+---+---+--
| 35| 45|   |   |   | ...
+---+---+---+---+---+--
 100 101 102 103 104  ...

p = &x; q = &y;

x   y   p   q
+---+---+---+---+---+--
| 35| 45|100|101|   | ...
+---+---+---+---+---+--
 100 101 102 103 104  ...

p = q;

x   y   p   q
+---+---+---+---+---+--
| 35| 45|101|101|   | ...
+---+---+---+---+---+--
 100 101 102 103 104  ...

 

 

#include<stdio.h>

#include<conio.h>

void main()

{

            int x=35,y=45;

            int *p, *q;

            p = &x;

            q = &y;

            p = q;

            printf(“\n*p = %d”,*p);

            printf(“\n*q = %d”,*q);

}

 

Output

            *p = 45

            *q = 45

 

 
Pointer Assignment

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Back - C Language Notes By Vivek Sir email: vivekdubey22@gmail.com (w) 9826424484

C Language Video