what is garbage value?
is it have any importance for this
Memory management is one of the most crucial works for any programming language. Considering an application that reads a set of data and than write it to a database, for this it will use some intermediary storage place where it will store the data before putting it on to the database. Now, if that intermediary memory place is not cleared of the previous data it might result into its exhaustion which will bring our application down. To prevent such a case from occurring there can be two ways, one, clear the memory manually like in C++ or C, else, employ a background process of garbage collection to do this work automatically.
In a language like C, when you define a variable, like: int x; a small block of memory is allocated to the variable. However, we have only declared the variable, and not initialized it, which means that the block of memory that has been allocated to the variable still contains some value that has been left over from previous programs and operations. That value is called a garbage value. This may lead to erroneous results in programs. To avoid this, declare and initialize variables like this: int x =0;
it will automatically deallocate the memory
I can't understand that how garbage value automatically holds