C ++ is a fun trick (help clarify the person). Znachitso so, I have a friend - the second day I explain to him an incomprehensible problem (until now). For example, there is a comparison:
if (123123123 == num) // num - int
so here The person does not understand the difference between the example shown above and the following:
if ((int)123123123 == num)
So, as I explained: 123123123 - the compiler does not know what it is (it's like that 1 can be interpreted as true, and 0 as false). I told him that 123123123 is simply untyped garbage, which the compiler will arbitrarily lead to a type that he likes and on this basis we can get a similar comparison.
if(true == num) //
And it turns out that for any num non-zero condition will be true.
People, if anyone has a clearer explanation of what is happening - write :) Well, sooooo need :)