0

Why is it good practice to assign NULL to a pointer when declaring it?

31st Jul 2016, 7:13 PM
Awni
Awni - avatar
1 Antwort
0
Since, a pointer can point to anywhere in the memory area, to keep the variable hold a valid memory location and not garbage. So to keep dangling issues aside a good practice is to assign NULL when declared.
1st Aug 2016, 2:01 PM
Pradyot Hota
Pradyot Hota - avatar