main()
{ int i;
printf("%d",((i=1)*i-- - --i*(i=-3)*i++ + ++i));
}
ans is 24 bt how?pls tell smbody............
Answer Posted / gorgeousgirl
Answer: 34
confirm the answer with http://codepad.org/PudiZIaS
Explanation:
by order of precedence, parenthesis hav highest priority
so
(i=1)*i-- - --i*(i=-3)*i++ + ++i
i=1 i=-3
now, i=-3
after assignment operations the expr becomes,
>(i)*i-- - --i*(i)*i++ + ++i
next higher priority is for auto-in/decrement
omitting post in/decrement(as they hav effect only after
this line of code), we get,
> i*i - --i*i*i + ++i
the associativity for printf statement is from right to left
so ++i is executed first before --i where i=-3
> i*i - --i*i*i + -2
now i=-2
> i*i - -3*i*i + -2
now i =-3
next precedence is for multiplication
> -3*-3
-
-3*-3*-3
+
-2
> 9 - -27 + -2
> 9 + 27 -2
> 9 + 25
> 34
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
largest Of three Number using without if condition?
What is the difference between the local variable and global variable in c?
Is c dynamically typed?
Why is sizeof () an operator and not a function?
What is difference between Structure and Unions?
What is typedef?
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
What is extern variable in c with example?
Is int a keyword in c?
I came across some code that puts a (void) cast before each call to printf. Why?
Explain 'bit masking'?
what do u mean by Direct access files? then can u explain about Direct Access Files?
What are header files why are they important?
What is huge pointer in c?
What is the difference between void main and main in c?