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 ?    5 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
 
Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV Accenture3
what is difference between overriding and overloading?  1
write a function which accept two numbers from main() and interchange them using pointers?  3
what is the use of pointers  5
What compilation do? Geometric-Software7
what is the differance between pass by reference and pass by value. Infosys4
how many header file is in C language ?  13
write a program for size of a data type without using sizeof() operator?  7
What are data breakpoints? Adobe1
Reverse the part of the number which is present from position i to j. Print the new number.[without using the array] eg: num=789876 i=2 j=5 778986  2
Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod() Accenture1
what is op? for(c=0;c=1000;c++) printf("%c",c); Trigent18
What are the uses of pre-processor directives?  2
write a program to display the array elements in reverse order in c language  6
program to get the remainder and quotant of given two numbers with out using % and / operators? IBM8
which of the following go out of the loopo if expn 2 becoming false a.while(expn 1){...if(expn 2)continue;} b.while(!expn 1){if(expn 2)continue;...} c.do{..if(expn 1)continue;..}while(expn 2); d.while(!expn 2){if(expn 1)continue;..} TCS2
how to impliment 2 or more stacks in a single dimensional array ? iFlex1
write a program to find the sum of the array elements in c language?  8
regarding the scope of the varibles;identify the incorrect statement: a.automatic variables are automatically initialised to 0 b.static variables are are automatically initialised to 0 c.the address of a register variable is not accessiable d.static variables cannot be initialised with any expression TCS1
implement general tree using link list Wipro1
 
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