Difference between null pointer and dangling pointer?

Answer Posted / vrushali

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 ?    27 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you write a program which produces its own source code as output?

599


Explain what is the difference between a string and an array?

625


How do you determine the length of a string value that was stored in a variable?

642


What are keywords in c with examples?

597


Describe the steps to insert data into a singly linked list.

613






what is the different bitween abap and abap-hr?

1737


Explain what are global variables and explain how do you declare them?

634


What is c++ used for today?

653


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

556


What do you mean by c what are the main characteristics of c language?

562


What is null in c?

591


What is size of union in c?

572


Difference between goto, long jmp() and setjmp()?

697


How to compare array with pointer in c?

611


What is structure in c definition?

565