ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Difference between null pointer and dangling pointer?
 Question Submitted By :: Sourisengupta
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Difference between null pointer and dangling pointer?
Answer
# 1
NULL pointer points to nothing.
But dangling pointers are those pointers which points to
invalid location (e.g. still points to those memory
locations which are already freed)

int *p = NULL;
   Is mere a pointer which is not initialised to valid
memroy location. it points to nothing

int *q ;
q -> 0x1A
free (q);

still we can access this pointer using q. Still memory has
not been released to the system.
 
Is This Answer Correct ?    6 Yes 2 No
Vrushali
 
  Re: Difference between null pointer and dangling pointer?
Answer
# 2
If free() is not able to free the memory then how we are 
freeing the memory????
 
Is This Answer Correct ?    1 Yes 1 No
Sourisengupta
 
 
 
  Re: Difference between null pointer and dangling pointer?
Answer
# 3
free should be able to free as it maintains a table from
where it can start freeing the memory. It is OS related issue.

There is no way in C where we can ensure that the particular
memory is freed a even after free we can access the variable
for some time.  In Java, we have a memory deallocator.
 
Is This Answer Correct ?    1 Yes 1 No
Vrushali
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Describe advantages and disadvantages of the various stock sorting algorithms Microsoft1
we have to use realloc only after malloc or calloc ? or we can use initially with out depending on whether we are using malloc or calloc in our program ?  1
What are data breakpoints? Adobe1
Two's compliment of -5 Adobe3
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 } Wipro4
print ur name without using any semicolon in c/c++....  6
what is the difference between entry control and exit control statement?  2
how to sort two array of characters and make a new array of characters. Accenture1
#ifdef TRUE int I=0; #endif main() { int j=0; printf("%d %d\n",i,j); } ADITI2
what does " calloc" do? Cadence6
c programming of binary addition of two binary numbers  1
what is the difference between declaration and definition of a variable or function ?  2
What is the purpose of Scanf Print, getchar, putchar, function?  2
HOW DO YOU HANDLE EXCEPTIONS IN C? AppLabs2
what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf("%d",*c); ++q; } for(j=0;j<5;j++) { printf("%d",*p); ++p; } }  4
program to find the second largest word in a paragraph amongst all words that repeat more thn twice iGate3
what is the function of void main()?  6
void main() {int a[5],i,b=16; for(i=0;i<5;i++) a[i]=2*i; f(a,5,b); for(i=0;i<5;i++) printf("\n %d",a[i]); printf("\n %d",b); } f(int *x,int n,int y) { int i; for(i=0;i<n;i++) *(x+i)+=2; y=y+2; }wat r the errors in the prg.and improvise the prg to get o/p.?  2
WAP to accept first name,middle name & last name of a student display its initials? NIIT2
a 'c' program to tell that the set of three coordinates lie on a same line Persistent1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com