Q : What is dangling pointer in C? What is wild pointer in C? Give example?
Dangling or wild is a pointer which does not point valid object. When a pointer has declared it must be assign a valid address memory address otherwise it will point some location which is not valid. These are special cases of memory safety violations. More generally, dangling references and wild references are references that do not resolve to a valid destination.
As in above program c falls out of scope due to local variable and there is an attempt to read C variable which is cleared from memory.
A wild pointer also points an invalid memory address as in following program. Arbitrary memory location and may cause a program to crash or behave badly