c - Is there any difference between if(!n/10)return; and if(n/10==0)return;? -


can me? there difference between

if (!n / 10)     return;  

and

if (n / 10 == 0)     return; 

yes, 2 statements different. !n / 10 equivalent (!n) / 10 , n / 10 == 0 equivalent !(n / 10).
operator ! has higher precedence of / operator , therefore n bind ! first in !n / 10.

as @kerrek sb pointed in comment, !n evaluated either 0 or 1 so, expression false.


Comments