mercredi 30 novembre 2016

C "if" structure

I am learning C and my question might be silly but im confused.In a function like:

  int afunction(somevariables)
    {
        if (someconditions)
        {
         do some stuff
         return 1;
        }
        raise_error("error happened")
        return 0;
    }

My question is,if the if statement isnt meeted(success),then it will go to the raise_error ? in other words,does the raise_errors position act like if it was in a else statement,or its because you have to return something at the end(return 0)?or would it need a proper else statement?Basically im confused on how to make a propre if condition--if this condition isnt meet--then call raise_error.

thank you!

Aucun commentaire:

Enregistrer un commentaire