So, let's say, I have this piece of code:
int value = 256;
if( check_value_1(value) && check_value_2(value) )
{
// .. do stuff ..
}
If function check_value_1()
returns FALSE
will check_value_2()
be called?
So, let's say, I have this piece of code:
int value = 256;
if( check_value_1(value) && check_value_2(value) )
{
// .. do stuff ..
}
If function check_value_1()
returns FALSE
will check_value_2()
be called?
If check_value_1(value)
returns FALSE
, the second portion of the if-statement will be skipped and will not execute. This is known as short circuit evaluation.
No, C does a lazy evaluation and return FALSE.
read more about it https://en.wikipedia.org/wiki/Short-circuit_evaluation