+ 3
what is the meaning of uninitialized local variable
3 Réponses
+ 3
uninitialized variables are ones without values I.e variables which are not assigned values to
+ 7
int x; // this variable (x) is uninitialized
int y = 42; // this variable (y) is initialized with value 42
+ 4
Uninitialized local variable is a variable that was declared inside a function but it was not assigned a value. It contains default value for that data type.
Using an uninitialized variable in an expression may give unexpected results or cause compilation errors. So you should always initialize variables.