Right Click to Search

Tuesday, January 5, 2025

De-Referencing Pointer in C Programming


De-Referencing Pointer in C Programming Language :
  • Dot(.) indirection operator is used along with pointer variable
  • Dot Operator is also called as value at operator
  • When used with Pointer variable. It refers to variable being pointed to,this is called as De-referencing of Pointers
Pointer De-referencing :
  • operation performed to access or manipulate data contained in memory location pointed to by a pointer
  • Any Operation performed on the de-referenced pointer directly affects the value of variable it pointes to.
Demo Example : 

// Sample Code for De-referencing of Pointer
int n = 50 , x ;
int *ptr ;        // Un-initialized Pointer
ptr = &n;         // Stores address of n in ptr
x = *ptr;         // Put Value at ptr in x 

Evaluation :

// Sample Code for De-referencing of Pointer
*(ptr) = value at (ptr)         
       = value at (2001) //Address in ptr is nothing but address of n
       = 50  

Summary :
  1. Name of Normal Variable always points to the Value  of variable
  2. Pointer variable always Stores Address of variable
  3. *ptr = n are one and the same
Variable Value in it
n 50
&n1002
ptr1002
*ptr50




Bookmark & Share

Tags / Keywords : |

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates