+ 1

#include <stdio.h> int main() { int var1,var2; var1=10; var2=10; var2=2*(++var1+2) - 2*(--var1-2); printf("Var1=%d \n Var2=%

Why the output in Var1=10 and Var2=10? (Tomorrow I will have a test please help)

25th Mar 2019, 10:17 PM
Gab
Gab - avatar
1 Odpowiedź
+ 1
var1 = 10 because: ++var1 is 11 and - - var1 reduced it to 10 again. var2 = 10 because : var2 = 2 * (11 + 2) - 2 *(10-2) = 2*13 - 2*8 = 26 - 16 = 10
25th Mar 2019, 10:56 PM
Bahhaⵣ
Bahhaⵣ - avatar