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
What is volatile variable how do you declare it?
What are the advantages and disadvantages of c language?
What is meant by gets in c?
Can the “if” function be used in comparing strings?
What is equivalent to ++i+++j?
Write a C program to count the number of email on text
What Is The Difference Between Null And Void Pointer?
Give differences between - new and malloc() , delete and free() ?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
What are the rules for identifiers in c?
Explain what header files do I need in order to define the standard library functions I use?
What are identifiers c?
in linking some of os executables are linking name some of them
how we can make 3d venturing graphics on outer interface
What is the explanation for modular programming?