Computer Science, asked by vitansinghai4825, 8 months ago

How can we avoid dangling pointer, while returning local variable to function call?

Answers

Answered by TarunTanwar9671
1

Answer:

Dangling pointers in computer programming are pointers that pointing to a memory location that has been deleted (or freed).

Explanation:

Dangling pointers arise during object destruction, when an object that has an incoming reference is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory.

The system may reallocate the previously freed memory, unpredictable behavior may result as the memory may now contain completely different data.



plz mark in braniliest plz

Answered by shruthi2000v
3

Answer:

The pointer pointing to local variable doesn't become dangling when local variable is static.  

Explanation:

Similar questions