Differencing Pointer in C Programming Language :
- Differencing Means Subtracting two Pointers.
- Subtraction gives the Total number of objects between them .
- Subtraction indicates "How apart the two Pointers are "
int n , *p ,*q ;
// P stores the address of Variable n
p = &n ;
// Value of q is incremented by 4 bytes
q = p + 2 ;
// Differencing two Pointers
printf("%d",q-p);
Output : 2
Observations & Explanation :
- Numerically Subtraction ( q-p ) differs by 4
- As both are Integers they are numerically Differed by 4 and Technically by 2 objects
- Suppose Both pointers of float the they will be differed numerically by 8 and Technically by 2 objects
Bookmark & Share


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