c++ - Defining double exclamation? -


i understand double exclamation mark (or think understand) not sure how defined on random object. example in code snippet below:

assignment *a; if (!getassignment(query, a)) return false; hassolution = !!a; if (!a) return true; 

how know value double exclamation mark result in ? in other words convert true ? false ? or can define behavior such executing method determine result (how object know how act in situation) ? bit confused piece of code due these exclamation stuff going on.. explanation appreciated.

hope clear , thanks.

a pointer. in c++, nullptr defined invalid pointer. !pointer turns nullptr pointer true , non nullptr pointer false. !boolean turns true false , false true. work.

!(!a) useful way think of it.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -