gcc - What does if((x=0)) mean in C? -
so apparently, in gcc/c, compiler compiles when
if ((x=0)){ code }
is used, while when
if (x=0){ code }
is used, compiler refuses compile.
what differences between two?
as note, know difference between x==0
, x=0
. exploring how c behaves when met weird codes.
there no difference, code-wise.
all that's happening saying x=0
instead of x==0
such common mistake compilers emit warning (or error, in case) when see it. set of parentheses common trick shut compiler --- equivalent of saying 'yes, meant this'.
Comments
Post a Comment