jeudi 5 octobre 2017

Are the following statements equivalent in C?

If my_function() returns a 0 for success or -EINVAL for failure, then would these two statements be equivalent?

if( my_function() ){  

and

if( my_function() == 0){

I'm aware that 1 is boolean True and 0 is boolean False in C, so I wasn't sure if the first statement would fail the if statement if my_function() successfully returned 0.

Aucun commentaire:

Enregistrer un commentaire