Debugging

I have one doubt, after declaring the variable and assigning a value, before initializing why the garbage value is not shown a zero ‘0’? Since we didn’t tell the variable to keep ‘any’ value then why and how it picks up random garbage data. For example in my case, I assigned a value of 3.899 to a double variable. Before initializing during debug it showed me a value of 6.0somethingSomething…

Similar to Unreal Blueprints, whenever we declare a variable, it doesn’t show any data[or maybe it shows but can’t see it] until we compile it.

Can you guys add this doubt in the video itself so that others who are wondering about the same as well.
Or
if it is explained in the video about ‘How and Why’ and I missed it please redirect me there.

Thanks in advance.

When you don’t initialize the variable, it gets initialized for you using whatever value happens to be in the location of memory used. This is a “feature” of C++

Blueprints, on the other hand, does automatically initialize to default values.

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

Privacy & Terms