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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -