Float variable is always initialized with 0

Float_init_0
The float variable root_beer is always initialized to 0 instead of containing garbage data, whereas the double variable cheese_burger is initialized with garbage.
Why is that?

Hello Mr_JC,

The answer is basically luck. When a variable is not initialized the compiler generally gets to choose what to put in (or just grabs from whatever is in that specific memory address).

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.