What is a dangling pointer?

Answer Posted / achal ubbott

Here is an example of dangling pointer.

char* p = new char;// allocate a byte from heap section.
delete p ; // deallocation.

*p = 44 ; // using a dangling pointer.

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the iterator and generic algorithms.

1492


declare an array of structure where the members of the structure are integer variable float variable integer array char variable access all elements of the structure using dot operator and this pointer operator

1749


What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass

701


What are abstract data types in c++?

547


Define a constructor - what it is and how it might be called (2 methods)?

614






What are the various storage classes in C++?

657


Differentiate between realloc() and free().

602


What character terminates all character array strings a) b) . c) END

684


How would you use the functions randomize() and random()?

637


How to declare a function pointer?

588


Do inline functions improve performance?

658


What is fixed in c++?

595


What is vectorial capacity?

658


Evaluate !(1&&1||1&&0) a) Error b) False c) True

713


What is difference between rand () and srand ()?

600