468,783 Members | 1,581 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,783 developers. It's quick & easy.

Dangling pointer

what is dangling pointer?can i get one example?
Aug 8 '07 #1
3 1599
JosAH
11,448 Expert 8TB
what is dangling pointer?can i get one example?
It's a pointer not pointing to a valid memory location:

Expand|Select|Wrap|Line Numbers
  1. void* p= malloc(42);
  2. free(p);
  3. // p is dangling now
  4.  
kind regards,

Jos
Aug 8 '07 #2
Meetee
931 Expert Mod 512MB
what is dangling pointer?can i get one example?
Hi,

Haven't you search on google?

"A pointer (access value) which points to an object that no longer exists." This is a web definition of dangling pointer.

See here.http://en.wikipedia.org/wiki/Dangling_pointer

Regards
Aug 8 '07 #3
weaknessforcats
9,207 Expert Mod 8TB
These are a big problem in C.

You can never delete a pointer unless you know there are no copies of it anywhere else in the program. This is not fun in a big program.

C++ works this issue by using handle classes.
Aug 8 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

13 posts views Thread by Aravind | last post: by
11 posts views Thread by John | last post: by
20 posts views Thread by __PPS__ | last post: by
5 posts views Thread by Richard | last post: by
1 post views Thread by sekhar_ps | last post: by
1 post views Thread by sridhard2406 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.