+ 2
Why in an array if we have not initialized it, displays garbage values on printing?
2 Answers
+ 1
Lets have an example, consider your wardrobe consisting of some stuff.
Now if you just declare that you want to store your stuff in the drawer of the cupboard without actually storing your desired data, when you access that drawer, you will find your old stuff.
Similarly in PC the data is stored on semiconductors, each memory location is tested by the manufacturer with some datatype, when we declare a variable, and not assign any value, the garbage value we get after accessing that data is this data
0
old data in the memory, from other programs,