Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
In C / C++, the variable will be initialised only if it's a global variable. A local variable will not be initialised, and it's actually bad practice to initialise everything "just in case".
-
And "not initialized" means that it well be some valid but unpredictable integer. Not null or undefined that you have in other languages :]
-
@Lensflare even better, if it's undefined anyway, the compiler can choose the fastest "undefined" and just optimise that shit away. Ideally the whole program.
- int varX;
v/s
- int varX = 0;
makes a shit ton of difference ๐๐๐
Always remember to initialize.
rant
variables
initialization