c++ - How to test if a variable is initialized? -
how test if variable has been initialized using if statement.
thanks everybody. wasn't needing test if initialized. received solution , information uninitialized variables well.
generally cannot , bad practice use uninitialized variables.
you may use this:
int x = -1; .... rest of code .... if( x == -1 ) { }
in above example assumed under program execution x
never set -1
. if -1 uninitialized.
Comments
Post a Comment