It was a question in an old exam :
the expression if(num != 65)can not be replaced by....... and the answer is:
if( !(num-65) )
but I can't understand this condition :( what is num-65, what does it mean?
Thanks

"num-65" : it subtracts 65 from num.

The reason the two expressions are different is because in the first one the value of num can be anything other than 64 in order to satisfy the expression. But in the second expression the only value of num that satisfies the expression is 65 because 65-65 is the only thing that make it 0.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.