Which of the following are potential problems when we use the delete operator on a pointer variable?

a. inaccessible heap memory
b. dangling pointers
c. uninitialized pointers
d. NULL pointers

b) Dangling pointer
Explanation:
A dangling pointer occurs when several pointers point to the same allocated memory, and one of the pointers has the delete operator applied to it. The memory is still there, but it now belongs to the free store manager. The remaining pointers point to deleted memory and are called are dangling. It is common to speak of the deleted pointer as dangling as well, but it might or might not still be pointing at the deleted memory. It is at best an error to delete a pointer that points to already deleted free store memory, and at worst a disaster.

Computer Science & Information Technology

You might also like to view...

New workbooks typically contain how many worksheets?

A) 0 B) 1 C) 2 D) 3

Computer Science & Information Technology

Answer the following statements true (T) or false (F)

1. In the Systems Development Life Cycle (SDLC), several activities may occur simultaneously, and activities may be repeated. 2. When implementing a new system, it is always best to determine the human needs of the users involved. 3. When answering questions concerning human-computer interaction (HCI) the analyst should ask questions such as, "What are the users' physical strengths and limitations?" 4. The first phase of the systems development life cycle is critical to the success of the rest of the project. 5. The second phase of the systems development life cycle begins with the documentation of the software being designed.

Computer Science & Information Technology