How garbage values are assigned to variables in c
c, memory
Solution
Does it mean C first allocates memory to variable 'a' and then what ever there is at that memory location becomes value of 'a'?
Exactly!
Basically, C doesn't do anything you don't tell it to. That's both its strength and its weakness.
Problem
C code : ``` int a; printf("\n\t %d",a); // It'll print some garbage value; ``` So how does these garbage values are assigned to uninitialized variables behind the curtains in C? Does it mean C first allocates memory to variable 'a' and then what ever there is at that memory location becomes value of 'a'? or something else?