Home > Mobile >  C Operation Order [duplicate]
C Operation Order [duplicate]

Time:09-30

I wanted to ask a question regarding the "C Operation Order". Can someone explain the order of the following?:

1) a = 1;
   x = a   * a  ;

2) a = 1;
   c = (a || (a  )) * a;

Thank you very much!

CodePudding user response:

  1. x = a * a ; is Undefined Behaviour.

  2. a = 1; c = (a || (a )) * a; it's as if the a does not exist because a is true.

CodePudding user response:

The first one is 1 because you add 1 after multiplying. And the second one doesnt make sense because || is a comperator.

  • Related