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
Post a Comment