What number will z in the sample code given below?
int z, x=5, y= -10, a=4, b=2;
z=x++ - --y *b/a;
Can anyone please solve it and explain the precedence. i am not getting right answer. my answer is 2.5. but it is wrong. i am struggling in it. kindly solve it and explain. Thanks in advance.
The first step is inserting parentheses according to the predence and order:
z = (x++) - (((--y) * b) / a);
Then replace the variables with their values:
z = (5++) - (((--(-10)) * 2) / 4);
Now solve step by step but observe the special handling of the postfix operator which will return a temporary copy that contains the value before the operation (that means x will be changed but the initial value of 5 is used for the calculation). Observe also that results might get rounded wirh integer arithmetic:
z = (5) - ((-11 * 2) / 4);
z = 5 - (-22 / 4);
// The remaining steps are left to your exercise
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
I have a C++ application which reads access (.mdb) file. This application runs fine on Windows XP,7 OS. But when I run the application on Embedded Standard OS, it gives me System Error 126 (Microsoft Access Driver).
What would be the best solution for this?
Kindly help in solving this problem.
Thanks In advance
Sorry but I have never used it in embedded. You will need to use the debugger, or similar tool, to gather more information. Have you tried Google to see if other people have come across the same problem?