Sunday, July 12, 2009

C++ test review question?

5 6 + 4 * 10 5 / - = ?


How does the order work here?


Y=Thanks in advance.

C++ test review question?
*/+-
Reply:It depends on your c compiler, none are required to follow any precedence. As a professional programmer, I ALWAYS use parens to force precedence.


1) Makes it easier to read


2) Forces compiler to follow your precedence





Your compiler's manual will have a index of precedence.

bouquet

No comments:

Post a Comment