0
Someone Please Explain the Values for a-z
I cannot figure out why the values for these 'None-valued' declarations of the alpha-variables "a-z", with type "int", are what they are. Can anyone please explain? below is the code snippet. https://code.sololearn.com/cZpfjBmuCtSG/?ref=app
3 Antworten
+ 6
Let's say you used some application/program and it utilized some memory.
At that memory location, program wrote some data and after some time you closed the application but the data could be present in that memory location.
Now later on, you create a program and declares an uninitialized variable. There's a chance that the variable might be pointing to the same memory location which was used by the previous program.
Now the variable have some garbage value which is unpredictable.
There could be a chance that an uninitialized variable would point to a memory location which was not used by any program and thus it don't have any garbage value.
+ 7
These are garbage values.
Uninitialized variables are referencing to some memory location which have some values.
These values are garbage values.
It's a good practice to initialize variables at the time of their declaration to avoid any logical errors.
+ 1
Wow, that's very peculiar to me. It kinda makes some sense of this situation, but why aren't they of a "None" or "Null" value when unassigned during declaration?