• Home
  • Tutorials
  • Interviews
  • Info Seed
  • Forums
  • Projects
  • Links
  • Contact Us
C Language
C POINTERS
INTRODUCTION
What are POINTERS?
Illustration of POINTER assignments
Illustration - II
Illustration - III
POINTER arithmetic- POINTER + number
POINTER - number
POINTER - POINTER
NULL POINTER
Common Errors
DEREFERENCING NULL
DANGLING POINTER
REFERENCING DE-ALLOCATED MEMORY
MEMORY MANAGEMENT

 

 

ILLUSTRATION-III

*y=x; // gives an ERROR as data types don’t match. x is not an int but pointer to int

x=*y; // gives ERROR again as *y is not Int* but int. In other words *y is not a pointer but a Int value while x is int* i.e. pointer to int.

*y=i; // both the data types are same INT and hence value of i is assigned to pointee of y.

i=7; // value of i is changed i.e. pointee of x is changed.

Memory map at this moment showing result of above 2 statements is as:

www.exploreroots.com

x=y; // both x& y are int* i.e. pointers. Now both pointers point to same place and previous pointee of x retains the value.

 

 

 

 

Memory map at this moment is as:

 www.exploreroots.com

 


previous next
| Copyright © 2009 exploreroots- All Rights Reserved | Disclaimer |