By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 847 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

dangling pointer

P: 28
if we store some value at the place in memory which void pointer references then we increment void pointer this leads to dangling pointer?can any one explain whats the reasons for dangling pointer
Jun 21 '06 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,916
Not necessarily, it's only really dangling if the area of memory it now points to is not available for you to use and it's only dangerous if you then write to that location.

A dangling pointer is really a pointer that is pointing to some random piece of memory that the code in question has no right to access, for instance

Expand|Select|Wrap|Line Numbers
  1. int array[20];
  2. int *pI;
  4. pI = array + 100;
leaves pI dangling.
Jun 21 '06 #2

Post your reply

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