• 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

 

 

DANGLING POINTER:

The dangling pointer ERROR is an error in which we try to dereference to a memory place which has not been allocated yet.

Int* x;

*x=3;     DANGLING POINTER ERROR

After execution of statement 1, in the memory map x can be described as follow:

www.exploreroots.com

As till now we have allocated no pointee to the pointer and still we are try to dereference. As there is a random address stored in the pointer, hence if we dereference it now then we may dereference a wrong memory and hence may even corrupt some crucial application.

How ever if we only try to print the value *x then there are no chances of corrupting any application and hence it would not cause much harm but still an erroneous output. It is also called bad pointer bug.

 


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